summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
Commit message (Collapse)AuthorAgeFilesLines
* tst_QDateTimeEdit::stepModifierPressAndHold(): tweak start dateEdward Welbourne2023-03-281-1/+5
| | | | | | | | | The test can collide with a 1960-01-01 transition in some zones, so move it to Jan 2nd to avoid that. Pick-to: 6.5 Change-Id: I5286cadc0de0b66283253b0ac736f23a2add0c8f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QComboBox: reset indexBeforeChange to -1 if index is invalidatedAxel Spoerl2023-03-281-37/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The member variable indexBeforeChange is member-initialized with -1 and changed to the current row, if a valid index is set. It is used to check, if the model has been reset to an empty model and/or the index has been invalidated. The result is used to decide, if the currentIndexChanged signal is emitted or not. If a combo box had a valid index and it is invalidated afterwards (e.g. because the combobox has no more entries), indexBeforeChange is not reset to -1. The redundant signal emission is therefore prevented only the first time. This patch resets indexBeforeChange if the index is invalidated or the last item is removed from the combo box. It also adds a no-op check to tst_QComboBox::currentIndex. The test data sets "check that setting the index to -1 works" and "check that current index is invalid when removing the only item" check the respective use cases. As a drive-by, variable names and QObect::connect syntax have been cleaned up in tst_QComboBox::currentIndex. Fixes: QTBUG-108614 Pick-to: 6.5 6.2 Change-Id: Ib6dfa887d9247f2c47df065039d69ba57c32fa24 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Widgets/QCheckBox: change signature of stateChanged() for Qt7Christian Ehrlicher2023-03-211-11/+16
| | | | | | | | | | | Change the signature of stateChanged(int) to emit Qt::CheckState instead. This was forgotten during Qt6 porting so we have to wait for Qt7. Task-number: QTBUG-104688 Change-Id: Ica2504e5b9ae68612de81524faed0f31c9b10402 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QColorDialog: Support hex rgb values with and without leading #Axel Spoerl2023-03-171-0/+53
| | | | | | | | | | | | | | | | | | QColorDialog supports entering hex rgb values only with a leading #. That makes copy/paste impossible whenever the copy source has plain hex, without the leading #. This patch automatically adds a leading # character, when missing. As a drive-by, QObject::connect statements are altered to PTMF syntax, amending 9eb1b9e86ce3d1004e39e8ab7c7ecb6796d6df1a. The patch also adds an autotest for the new functionality. Fixes: QTBUG-111742 Pick-to: 6.5 Change-Id: I4ced29dc8b543457f411a3fa0ac756b550cdb09f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Handle device loss for texture widgetsDavid Redondo2023-03-171-0/+46
| | | | | | | | | | | | Previously the widget stayed black and we printed "QBackingStoreDefaultCompositor: the QRhi has changed unexpectedly, this should not happen". To make it work the compositor is recreated in addition to the rhi and the widgets are informed with the internal events. Change-Id: I982d08bd3530478fe0f827080154c008a92a812e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QPlainTextEdit: Don't block signals on page stepAxel Spoerl2023-03-151-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | Signals of the vertical scroll bar were blocked when scrolling with pageUp/pageDown keys or clicking on the scroll range outside the scroll bar. This has lead to inconsistent signal emissions: The vertical scroll bar's valueChanged signal was emitted only on single steps and when the scroll bar was moved with the mouse. When it was moved in page steps by clicking on the scroll range or pressing pageUp/pageDown, it was not emitted. This patch removes the signal blocker for page step movements, which was added in 94fd108ea42a99dacefa819bc3fd4363fb95e886 to replace explicit calls to blockSignals(), which were added in c14d442b08ac81327b173b0a220c7b1840667899. The patch also adds test function to tst_QPlainTextEdit to check if the valueChanged signal is emitted correctly. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-8682 Fixes: QTBUG-25365 Change-Id: I4385a5387c91497f623978e35bbbe3e06f473afe Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* emit QAbstractSlider::valueChanged() only on value changeAxel Spoerl2023-03-151-3/+7
| | | | | | | | | | | | | | | | | The signal has been emitted also, when the slider position has changed without a value change (e.g. on QWidget::show() or on resizing). This patch stops emitting the signal without a value change. It adds a verification to tst_QAbstractSlider::setValue(), that valueChanged is not emitted on a no-op value change. As a drive-by, the patch removes an unnecessary assignment and changes signal spy constructions to PTMF syntax. Pick-to: 6.5 6.4 6.2 Task-number: QTBUG-25365 Change-Id: I9932e45d4e680aa53422ca75aa42a16306213a38 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QCompleter::setPopup() - refactor and cleanupAxel Spoerl2023-03-141-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QCompleter::setPopup() sets window flags, focus policy, parent, focus proxy, item delate and installs an event filter, before the popup argument is assigned to d->popup. In the QCompleter::eventFilter override, QObject::eventFilter is called (under more) if d->popup is nullptr. If a custom class is inherited from QCompleter and it overrides QObject::eventFilter(), this causes an infinite loop. This patch re-factors the method. - early return is added if the new popup != d->popup - remembering the existing widget's focus policy is constified and moved ahead of the delete secion. - assignment of d->popup to popup argument is moved after the delete section. - after assignment, the argument variable is no longer used. The refactoring eliminates two issues: - potential risk of double-installing event filter due to missing early return. - inifite loop if inherited class installs another event filter. The patch adds a test function to tst_QCompleter, which implements an inherited class, installs an event filter on a popup and checks if a ChildAdded event hass been recorded. Fixes: QTBUG-111869 Pick-to: 6.5 6.2 Change-Id: I3f7a2434a11476077a5260e7686a912da9f6c60d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QThread: add sleep(std::chrono::nanoseconds) overloadAhmad Samir2023-03-131-3/+3
| | | | | | | | | | | | | | All the other overloads are implemented using the new one. Windows change relies on the pre-check in the code review making sure it compiles. [ChangeLog][QtCore][QThread] Added sleep(std::chrono::nanoseconds) overload. Task-number: QTBUG-110059 Change-Id: I9a4f4bf09041788ec9275093b6b8d0386521e286 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cleanup QPushButton auto test codeVolker Hilsheimer2023-03-091-133/+129
| | | | | | | | | | Fix coding style, replace QVERIFY(a == b) with QCOMPARE, use nullptr, use a lambda for a local slot, and wait for the test widget to go away so that it doesn't break following tests. Change-Id: I1a4f790084b92301444a96a1449c84bf3317b88a Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Handle tab order inceptionVolker Hilsheimer2023-03-091-0/+125
| | | | | | | | | | | | | | | | | If a composite widget is put behind one of it's contained children via QWidget::setTabOrder, then our logic might replace the composite widget with the contained child. In that case, we'd end up with a broken tab chain, possibly resulting in incomplete clean-ups and triggering asserts when shutting down the UI. Handle this by stopping the last-child searching logic at the respective other widget, and by not allowing both widgets to be the same. Augment test case, and apply some minor refactoring to the code. Pick-to: 6.5 6.2 Change-Id: I7d97dfa85315b6c01daa283253025d94a1727048 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QErrorMessage: Reset 'again' check box between each error messageTor Arne Vestbø2023-03-091-2/+1
| | | | | | | | | | | | | | | The choice of whether to show a message again is per message, so when showing a new message we need to reset the check box back to its default checked state, otherwise the user might mistakenly dismiss more than the indented message. [ChangeLog][Widgets] QErrorMessage will now reset the check box for showing a message again for each new message shown, as each individual message has its own suppression state. Pick-to: 6.5 6.5.0 Change-Id: I86d4bb5eabdb5b7a478c03516108a5edf87fcbe3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QAbtractItemView: deselect before click opens editorVolker Hilsheimer2023-02-281-16/+13
| | | | | | | | | | | | | | A click on the selected item should deselect all other items before editing starts. Remove the part of the test case that assumes that we can have multiple items selected in ExtendedSelection mode, and click on an item to start editing while maintaining selection. That can never happen. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-111131 Change-Id: I0312eed4614502cfb77eca26d3f7615427493d7d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QListView: Reset style after using a temporary proxyVolker Hilsheimer2023-02-271-0/+5
| | | | | | | | | Amends 0242be90606b377864c6fd02d5a8e0afaf635acf, and removes unwanted side effect of having a modified style behavior for later functions. Pick-to: 6.5 6.4 6.2 Change-Id: If3dff0d7ab9e6c6c10e7a92d0a3eaff98fa1457f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* qalgorithms.h: fix mistake that MSVC has constexpr bitops in C++17 modeThiago Macieira2023-02-221-1/+1
| | | | | | | | | | | | | | | | | | <bit> exists in C++20 and is properly both constexpr and optimized. But in C++17 mode, we don't have constexpr bitops and instead elect to have performance at runtime instead. But somewhere along the line, either when they were added, when C++20 <bit> support was, or in any of the bugfixes for other compilers, the nesting of #ifdef got messed up and we declared that we had constexpr builtins for MSVC in C++17 too. The macro QT_HAS_CONSTEXPR_BUILTINS isn't supposed to be used by anyone else... but we ended up not being able to use it ourselves either. So I'm renaming it to a more precise label. Pick-to: 6.5 Change-Id: I9671dee8ceb64aa9b9cafffd1741b9b4060c9753 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Android: SKIP cases failing on Android 12 CI with 16GB RAMRami Potinkara2023-02-201-0/+4
| | | | | | | | | | | | | | | SKIP tst_QRhi::tessellation(Vulkan) SKIP tst_QOpenGLWidget::reparentHidden() SKIP tst_qvulkan cases Task-number: QTBUG-108844 Task-number: QTBUG-111235 Task-number: QTBUG-111236 Task-number: QTQAINFRA-5391 Task-number: QTQAINFRA-4733 Pick-to: 6.5 Change-Id: Id227367477173b6ad4cf9433af8eab5976596e70 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QGesture: make sure we copy timestamp value for event clonesVolker Hilsheimer2023-02-171-0/+62
| | | | | | | | | | | | | | Otherwise, double-click recognition will fail. Use QEvent::clone when possible, or set the timestamp explicitly when not. As a drive-by, remove some long-dead code in affected code lines. Fixes: QTBUG-102010 Pick-to: 6.5 6.4 6.2 Change-Id: I882bf6e8090bf6f182b7a0a3c62aa3a4c8db2e14 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tests: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-17131-310/+14
| | | | | | | 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>
* macOS: Pick up QWizard background from keyboard assistant via NSBundleTor Arne Vestbø2023-02-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | As of macOS 10.14 the keyboard assistant background is shipped as part of the compiled asset catalog of the app, so looking it up via a URL will fail. Instead we look it up via NSBundle's dedicated image lookup function, which handles both cases. The logic has also been moved to qwizard.cpp, since the additional plumbing via QPlatformNativeInterface was unnecessary. The keyboard assistant itself no longer shows the background image as of macOS 12, so we might consider doing the same, but the design of the assistant has also changed significantly, so as long as our QWizard layout looks like the old keyboard assistant we keep the background as well. Pick-to: 6.5 6.2 Change-Id: I7d42dd79b285f3518837458864bca6bc353b3b6d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QAbstractItemView: don't start editing on Ctrl-ClickVolker Hilsheimer2023-02-161-1/+43
| | | | | | | | | | | | | | | | | | | Amends 17c1ebf8bfd254ff75cc55e335d1c1fb01da547f, after which dragEnabled item views toggled selection on click rather than on press. If the edit trigger included SelectedClicked at the same time, then Ctrl-Clicking a selected item would start editing the item, instead of toggling selection. Fix this by ignoring clicks with modifier when evaluating whether editing should start. Extend the mouseSelection test case by including a column for the editTrigger, and cover the respective combinations. Fixes: QTBUG-111131 Pick-to: 6.5 6.4 6.2 Change-Id: I9605f9b3d5a49e292551a34c3c4c7a5f9ecb2a89 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix QStatusBar::removeWidget to hide the right widgetThorbjørn Lindeijer2023-02-161-0/+44
| | | | | | | | | | | | | `QStatusBar::removeWidget` was hiding the wrong widget (the next one), since the `removeAt` call changed the item that the `item` variable is referencing. This fixes a regression in Qt 6.3.0 (7166a82844500238a4dad91857384479c7). Pick-to: 6.5 6.4 Change-Id: I9977b47e6208f8d451ff1037bcb9f4e8414cb431 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
* Fix connections in QWidgetWindowDavid Edmundson2023-02-151-0/+6
| | | | | | | | | | A recent update moved handleScreenChange out of being a private slot. Porting to the new syntax fixes the warning and moves to a compile-time check. Pick-to: 6.5 Change-Id: Ibd85c6caf7dca051d669250a94a82fbddbd3435d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMenu: guard for destruction when emitting action signalsVolker Hilsheimer2023-02-131-0/+18
| | | | | | | | | | | | | | If a slot connected to a QMenu-action destroys the QMenu, then we must not touch data members in subsequent code, and instead return immediately. We cannot use QBoolBlocker here, as that would reset the data member of QMenuPrivate even when trying to return early. Fixes: QTBUG-106718 Pick-to: 6.5 6.4 6.2 Change-Id: I6b5ea471b1bf1f9864e1384382100f8f6c01346f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QAbstractItemView: Don't unselect on click on empty area in SingleSelectSebastian Beckmann2023-02-111-0/+32
| | | | | | | | | | | | | | | | dfb4697e4a4828acd47292a89207b3975ec6766e made a change to selection behavior that resulted in a regression where clicking on an item view but not on an item would cause the current item to get unselected. Changes the behavior to not update in this case. Added a new test that specifially checks for this scenario and ensures that the current item is still selected, even after the user clicks on empty area. Fixes: QTBUG-105870 Pick-to: 6.2 6.4 6.5 Change-Id: I191c3878819b99897083039fba0ab43908da5429 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Unblacklist stable tst_QWidgetRepaintManagerAxel Spoerl2023-02-031-11/+0
| | | | | | | | | | Failing test functions fastMove, moveAccross, moveInOutOverlapped seem to be stable in the meanwhile. This patch removes the blacklisting. Task-number: QTBUG-109036 Pick-to: 6.5 Change-Id: I9a2b015572e4d8a4eac196d3985c052030fd84e2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add right and middle mouse button to tst_QLabel::mouseEventPropagationAxel Spoerl2023-02-011-2/+11
| | | | | | | | | | | | The test function used only the left button to test mouse event propagation. This patch adds the right and middle buttons to the test data. Task-number: QTBUG-110055 Pick-to: 6.5 6.4 Change-Id: I02683168216843919e889987a8b0e8a0f1592d3a Reviewed-by: Doris Verria <doris.verria@qt.io>
* Fix two variables' "may be used uninitialized" compiler warningsAhmad Samir2023-01-221-1/+1
| | | | | Change-Id: Ie6063d7124b16681b3e39d465da21dd67206ebc3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWidgetTextControl: Ignore unconsumed mouse release eventsAxel Spoerl2023-01-211-0/+82
| | | | | | | | | | | | | | | | | | | | | | QWidgetTextControlPrivate::mouseReleaseEvent() has early returns implemented, e.g. when link has been right clicked or no selection anchor has been found. These early returns, however, still consume the event. This leads to events getting lost instead of getting propagated: As an example, a QLabel with rich text uses QWidgetTextControl. While it propagates mouse press events back to its parent, mouse release events get lost. A QLabel with plain text propagates both events back correctly. This patch adds QEvent::ignore() to the early return. Since no test class exists for QWidgetTextControl, it adds a test in tst_QLabel. Fixes: QTBUG-110055 Pick-to: 6.5 6.4 Change-Id: I950f8c3f135793b01c59832835bb429db2282169 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFormLayout: don't access out-of-bounds layout dataVolker Hilsheimer2023-01-131-0/+44
| | | | | | | | | | | | | | | | When rows are hidden (implicitly or explicitly), then their layout data does not get fully updated. If rows get hidden after the layout data has been calculated once, then we must make sure that their indices are reset. Otherwise we might access array indices that are out of bounds when the layout data structure gets resized to fit only visible rows. For good measure, skip entirely over hidden rows when accessing the layout data when arranging the widget. Fixes: QTBUG-109237 Pick-to: 6.5 6.4 Change-Id: I4d6943b6a110edb61f60ce78d31f0fc64b5cc03d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QCalendarWidget: Add reset functions for minimum/maximumDateVolker Hilsheimer2023-01-131-0/+8
| | | | | | | | | | QDateTimeEdit has such reset functions for the minimum/maximum range properties, this makes QCalendarWidget consistent with the simpler editors. Fixes: QTBUG-62448 Change-Id: Iabb89f599e4996f00488a885a5b8a009471838b3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Revert "Fix tst_QWidgetRepaintManager on XCB"Axel Spoerl2023-01-102-37/+12
| | | | | | | | | This reverts commit 4096667d6601dcbc5e713e6b0fd5b5218453c4cb. Reason for revert: <Screen shot workaround is flaky.> Change-Id: I6e01cc584c094d0d0b8c1544b9daf72d648dd002 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix tst_QWidgetRepaintManager on XCBAxel Spoerl2023-01-102-12/+37
| | | | | | | | | | | | | | | | | | | | Due to an XCB library change, QXcbBackingStore::toImage() cannot be safely assumed to return an image identical to QWidget::grab(). The test functions fastMove(), moveAccross() and moveInOutOverlapped() relied on QXcbBackingStore::toImage() and failed. They were backlisted on Linux/XCB. This patch obtains a screen shot instead of an image from the backing store on XCB platforms. It processes events until the screen shot matches QWidget::grab(). It makes the test fail only if the comparison times out. The patch also removes the BLACKLIST file, containing only the test functions mentioned above. Fixes: QTBUG-109036 Pick-to: 6.5 6.4 Change-Id: I26dd5b89dc62b313db066a285f6ad7d4d92baaf2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Don't override QDialog::setVisible() to implement native dialogsTor Arne Vestbø2023-01-092-0/+19
| | | | | | | | | | | | | | | | | | Clients who called the base-class implementation in QDialog would as a result start hitting the canBeNativeDialog code path at the start of QDialog::setVisible(), which would show the native dialog, but without updating the QWidget visibility state. To keep things 100% compatible, we shuffle the implementation of QDialog::setVisible() into QDialogPrivate, which allows us to override it in QMessageBoxPrivate and QErrorMessagePrivate. The existing subclasses of QDialog that override setVisible have been left as is, to not cause any unintended behavior change. Pick-to: 6.5 Change-Id: Icafe31a7b84a75049365e4e04b80492de08614d2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix QErrorMessage test when using native dialogsTor Arne Vestbø2023-01-092-0/+23
| | | | | | | | | | | | | | | | | When the test is showing the error message over and over, it's not waiting for the native dialog to actually become visible, and as a result, hiding it has no effect and won't result in a call to processResponse, where we got rid of the native dialog. To fix this we explicitly release the native dialog when encountering this corner case. Add logic to QErrorMessage to test both native and non native dialogs. Pick-to: 6.5 Change-Id: I19ac3f463997aed1e66f646fdfcbb4d2459116d1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QListView: Prevent infinite loop when wrapping text of item with null-iconVolker Hilsheimer2023-01-041-0/+17
| | | | | | | | | | | | | | | | | | If an item in a list view has a null icon, then the decorationSize gets calculated as -1, -1. The style would then try to wrap the text to a lineWidth of -1, ending up in an infinite loop in viewItemTextLayout. To prevent that, don't set the HasDecoration flag of the style option when the icon is null, and don't fall back ot the decorationSize unless the flag is set. Add a test for this particular item configuration. This also fixes the widget baseline test with styles that don't provide all standard icons. Pick-to: 6.5 Change-Id: I691db6abede9a9b2ad300f3ee7fbfdae5fb6097f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Skip tst_QWidget::optimizedResizeMove and ..._topLevel on waylandAxel Spoerl2023-01-031-2/+16
| | | | | | | | | | | | | | | | Wayland omits optimizations tested in tst_QWidget::optimizedResizeMove() and optimizedResize_topLevel() under certain circumstances, e.g. on Ubuntu 22.04 / Gnome. This makes the test functions fail. This patch skips the test functions on wayland platforms, if an omission is detected. This amends 2ec7a6322f465ad7cce3c48096d8912903196ab2. Fixes: QTBUG-109746 Pick-to: 6.5 6.4 Change-Id: If0df6b1cf451a7f0dccfc1bb7411e895d7ae29a3 Reviewed-by: Liang Qi <liang.qi@qt.io>
* tests: skip tst_QComboBox::cancelClosesPopupNotDialog() on WaylandLiang Qi2023-01-031-0/+4
| | | | | | | | | | | QWindow::requestActivate() is not supported. This amends c95de359b4fe7bc03f7defdb057ebbe79c51b3dd. Task-number: QTBUG-107153 Pick-to: 6.5 6.4 Change-Id: I45f53b5e9de85049ca41cc139a78a82450f53bed Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Stabilize tst_QSpinBox::sizeHint()Axel Spoerl2023-01-031-10/+8
| | | | | | | | | | | | | | | | | | | | | | The test function used to flake on Linux occasionally. 8e6ede7cd131682161180bfab0cc46686674709b provided a fix. While it seemed to work, further analysis has shown that the root cause is event sequence in case of multiple paint events. This patch re-engineers the test function: 1. Allocate test widget on the stack instead of the heap. 2. Send layout requests posted by QHBoxLayout constructor and QLayout::addWidget() before showing the widget. 3. Remove calls to QCoreApplication::processEvents(). They are unnessecary, because - the size hint request counter is supposed to increase (by any number) - QTRY_VERIFY processes events anyway until the counter increases or it times out. Pick-to: 6.5 6.4 6.2 Change-Id: I54998483725cbdd4899ba6f5469d7dae0980ab1d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Don't use native dialogs for tst_QApplication::closeAllWindows()Tor Arne Vestbø2023-01-021-0/+1
| | | | | | | | | | | | | The test shows an application modal QMessageBox, but assumes that doing so will be non-blocking, which for macOS is not the case (yet). Instead of making the dialog window-modal, which would potentially affect the logic of the test, we disable native dialogs. This should be fine, as the purpose of the test is to test the is_closing logic of closeAllWindows, which lives on a layer above the native dialogs. Pick-to: 6.5 Change-Id: I6d627984a6ca452b876f34404b669fce41a00851 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Use minimum size for in tst_QDockWidget::createTestWidgetsAxel Spoerl2022-12-291-0/+4
| | | | | | | | | | | | | | | | tst_QDockWidget::createTestWidgets did not set a minimum size for test widgets. Upon unplugging, that can lead to a size correction in connection with 8687c3f938cac56c4a2518576a5c9fac150d8de1, if the widget gets too narrow to correctly display window handles. Test functions checking the size after unplugging can fail in that case. This patch sets a minimum size to each test widget created. The minimum size corresponds to QStyle::PM_TitleBarHeight. Task-number: QTBUG-106531 Pick-to: 6.5 6.4 6.2 Change-Id: I3e552b37416d57d8ed30e0b9de4eec55f07ea158 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Stabilize tst_QSpinBox::sizeHint() by explicitly calling setLayout()Axel Spoerl2022-12-261-0/+1
| | | | | | | | | | | | | | The test function places a QSpinBox in a QHBoxLayout, which has a QWidget parent. The spin box is expected to be shown with the widget. While the widget is the layout's parent, the layout is not explicitly set. That makes the test function flaky in some cases. This patch adds QWidget::setLayout() to explicitly set the layout on the widget. Pick-to: 6.5 6.4 6.2 Change-Id: I3a1cc77c302c5ba96d3628d035139f9718dda9e5 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Android: Set EnterKeyNext as default type for QLineEditBartlomiej Moskal2022-12-211-0/+29
| | | | | | | | | | | | | | | | | Behavior of EnterKey for virtual keyboard need to be changed for QLineEdit. Before this commit, ImeOption was set to IME_ACTION_DONE. Because of that, setting any text in QLineEdit automatically accept QDialogs. That was annoying, when more than one QLineEdit need to be set. [ChangeLog][Widgets][Android] EnterKey type is now changed from EnterKeyDefault to EnterKeyNext for virtual keyboard in QLineEdit. It is done only if the focus can be moved to widget below. Fixes: QTBUG-61652 Change-Id: I98a7686f9f675fccf0112b8d27d48ad8fd7a887f Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Fix QWidget::restoreGeometry when restored geometry is off screenAxel Spoerl2022-12-161-0/+73
| | | | | | | | | | | | | | | | | | | | | | | If a widget's geometry is restored to a screen, which is smaller than the one it was saved from, - the widget could appear (partly) off screen - the widget's title bar and resize handles could be inaccessible This patch refactors and documents checkRestoredGeometry. In a first step, the restored geometry's size is checked against a given screen size. It is corrected if necessary. In a second step, the restored geometry is moved inside the screen, if necessary. It makes the function a static member of QWidgetPrivate in order to expose it for auto testing and adds a respective test function to tst_QWidget. Fixes: QTBUG-77385 Fixes: QTBUG-4397 Task-number: QTBUG-69104 Pick-to: 6.5 6.4 Change-Id: I7172e27bfef86d82cd51de70b40de42e8895bae6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QHeaderView test: Remove unused variablesVolker Hilsheimer2022-12-121-8/+0
| | | | | | | | | Silence warnings such as: variable 'sum_lookup_visual' set but not used [-Wunused-but-set-variable] Change-Id: If38515d9753cf7b79a250985890a139e96e92329 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Adapt to QTimeZone replacing Qt::TimeSpec usageEdward Welbourne2022-12-101-5/+6
| | | | | | | | | | | | In the process actually handle all time-spec cases in various places that only handled UTC or LocalTime, or at least note that they don't where that's not practical. Also tidy up header ordering and ensure QDateTime's header is included wherever it's used, while adding the include for QTimeZone where needed. Task-number: QTBUG-108199 Change-Id: Ic1a5cdf0aaf737bf1396aa8ac58ce2004cef7e19 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Port QDateTimeEdit internals to QTimeZoneEdward Welbourne2022-12-091-30/+10
| | | | | | | | | | | | | | | | | | | | | In the process, centralize the creation of date-time values, where doing so requires catching invalid results caused by spring-forward gaps; this saves some repetition and extends the treatment to more places that did need it. Also, de-inline two overrides of virtuals; being inline does them no good. Replace the Qt::TimeSpec member of QDTEPrivate with a QTimeZone so that creation of values can be streamlined and to make it easier to add support for (currently unsupported) OffsetFromUTC and TimeZone timespecs in the public QDTE API. This greatly simplifies a lot of the code, while preparing it for a long-needed extension to its functionality. Task-number: QTBUG-80417 Task-number: QTBUG-108199 Change-Id: I0ac2c78025013bf89899e3ef1a56e89392f67ce5 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QComboBox: Don't dereference potential nullptr, simplifyVolker Hilsheimer2022-12-081-0/+52
| | | | | | | | | | | | | | | | | | | | | | Amends a874087504cf5af8bb4171d4137f23f100b7063b, which tested whether d->container is nullptr to decide whether to hide the popup, and then dereferences d->container later without checking again. This raised a correct static analyzer warning. Simplify that logic. hidePopup() does nothing if there is no visible container, and we don't want to accept() the cancel key if there isn't. So the closeOnCancel logic isn't actually needed, we only need to accept the ShortcutOverride to make sure that QComboBox sees the Cancel key even if there is a shortcut registered, and then we can handle and accept the cancel key to call hidePopup() only if the popup is visible. Add test to verify that this interaction works as expected. Pick-to: 6.4 Task-number: QTBUG-108908 Change-Id: I60d92b068f0f5139d629cf4a58e225512170df77 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deliver tablet events to the toplevel widget if there is no childVolker Hilsheimer2022-12-021-44/+38
| | | | | | | | | | | | | | | | | | | | | QWidgetWindow dispatched only tablet presses to the toplevel widget if no child was found at the position; other events, such as hover events, were discarded. The tabletTracking test case even documented that shortcoming in a comment. Fix that by falling back to the toplevel widget for any event. As before, only press events initialize the tablet grabbing target widget. Remove the now unneeded parent widget from the test case, and move the test class into the only test function that uses it. Amends ea615b421b76668332a3029ad31fa725b5bb9e58 and 8fd6cef3724b2d676c5f6ae235956192d85eac39. Pick-to: 6.4 Fixes: QTBUG-108747 Change-Id: I79050f1e063931e439945f64b50712dcc1ecb18c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Cleanup tst_QWidget BLACKLIST fileAxel Spoerl2022-12-021-10/+0
| | | | | | | | | | | Remove legacy entries and operating systems from tst_QWidget's BLACKLIST. Task-number: QTBUG-25300 Task-number: QTBUG-45502 Task-number: QTBUG-68175 Change-Id: I6ce63ff5e616e0e1783ad6fb9ec0b1fe7ef18d0c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Stabilize tst_QWidget::optimizedResizeMove and optimizedResize_topLevelAxel Spoerl2022-12-021-49/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | The test functions tst_QWidget::optimizedResizeMove and tst_QWidget::optimizedResize_topLevel use a custom widget to record paint events in a boolean. Using QTRY_* or qWait() to wait for the boolean to become true stops event processing upon consumption of the first paint event. In case of multiple paint events, the next paint event will be recorded in the next check and may lead to a wrong result. This leads to flakiness on platforms generating multiple paint events, openSuSE Leap 15.4 / XCB being one of them. This patch replaces the boolean with a counter. It adds a waitForPaintEvents method to the custom class, which processes events, until the counter stops increasing. It returns true when paint events have been recorded and false otherwise. It resets the counter after each call. It also removes the QSKIP on wayland, as the failure results from the same reason. Fixes: QTBUG-109093 Pick-to: 6.4 Change-Id: I59ee8bb4efeaf5417d5749d21e384bee89301ae0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>