Commit Graph

3110 Commits

Author SHA1 Message Date
Friedemann Kleint
97bfacf1e2 tests: Remove remains of qmake conversion from CMakeLists.txt files
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>
2023-02-17 21:56:49 +01:00
Tor Arne Vestbø
c26c91b208 macOS: Pick up QWizard background from keyboard assistant via NSBundle
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>
2023-02-17 18:02:25 +01:00
Volker Hilsheimer
557dcd8a87 QAbstractItemView: don't start editing on Ctrl-Click
Amends 17c1ebf8bf, 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>
2023-02-16 15:28:18 +01:00
Thorbjørn Lindeijer
3e7226f107 Fix QStatusBar::removeWidget to hide the right widget
`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 (7166a82844).

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>
2023-02-16 12:40:07 +01:00
David Edmundson
ec8e6ed200 Fix connections in QWidgetWindow
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>
2023-02-15 15:12:12 +01:00
Volker Hilsheimer
52ce4d2d29 QMenu: guard for destruction when emitting action signals
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>
2023-02-13 18:20:25 +01:00
Sebastian Beckmann
f11e5435c7 QAbstractItemView: Don't unselect on click on empty area in SingleSelect
dfb4697e4a 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>
2023-02-11 12:47:24 +01:00
Axel Spoerl
b464119dd4 Unblacklist stable tst_QWidgetRepaintManager
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>
2023-02-03 18:44:55 +01:00
Axel Spoerl
593ffd3859 Add right and middle mouse button to tst_QLabel::mouseEventPropagation
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>
2023-02-01 17:41:58 +00:00
Ahmad Samir
5d356ae2bd Fix two variables' "may be used uninitialized" compiler warnings
Change-Id: Ie6063d7124b16681b3e39d465da21dd67206ebc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-22 21:19:36 +02:00
Axel Spoerl
7689d4ad2f QWidgetTextControl: Ignore unconsumed mouse release events
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>
2023-01-21 17:04:14 +01:00
Volker Hilsheimer
c3a5fe2fd7 QFormLayout: don't access out-of-bounds layout data
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>
2023-01-13 14:38:16 +01:00
Volker Hilsheimer
51272017a7 QCalendarWidget: Add reset functions for minimum/maximumDate
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>
2023-01-13 12:26:06 +01:00
Axel Spoerl
cccdd89ac8 Revert "Fix tst_QWidgetRepaintManager on XCB"
This reverts commit 4096667d66.

Reason for revert: <Screen shot workaround is flaky.>

Change-Id: I6e01cc584c094d0d0b8c1544b9daf72d648dd002
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-01-10 23:03:30 +00:00
Axel Spoerl
4096667d66 Fix tst_QWidgetRepaintManager on XCB
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>
2023-01-10 05:45:02 +00:00
Tor Arne Vestbø
e0bb9e81ab Don't override QDialog::setVisible() to implement native dialogs
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>
2023-01-09 14:14:53 +01:00
Tor Arne Vestbø
349fda471e Fix QErrorMessage test when using native dialogs
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>
2023-01-09 14:14:49 +01:00
Volker Hilsheimer
fb8701cb8b QListView: Prevent infinite loop when wrapping text of item with null-icon
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>
2023-01-04 13:42:06 +01:00
Axel Spoerl
df62cefdcb Skip tst_QWidget::optimizedResizeMove and ..._topLevel on wayland
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 2ec7a6322f.

Fixes: QTBUG-109746
Pick-to: 6.5 6.4
Change-Id: If0df6b1cf451a7f0dccfc1bb7411e895d7ae29a3
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-01-03 19:21:39 +00:00
Liang Qi
f09f516ac1 tests: skip tst_QComboBox::cancelClosesPopupNotDialog() on Wayland
QWindow::requestActivate() is not supported.

This amends c95de359b4.

Task-number: QTBUG-107153
Pick-to: 6.5 6.4
Change-Id: I45f53b5e9de85049ca41cc139a78a82450f53bed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-01-03 12:07:43 +01:00
Axel Spoerl
71e67dec95 Stabilize tst_QSpinBox::sizeHint()
The test function used to flake on Linux occasionally.
8e6ede7cd1 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>
2023-01-03 10:57:21 +01:00
Tor Arne Vestbø
ad31b5f4c7 Don't use native dialogs for tst_QApplication::closeAllWindows()
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>
2023-01-02 23:12:30 +01:00
Axel Spoerl
c69e727274 Use minimum size for in tst_QDockWidget::createTestWidgets
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>
2022-12-29 13:53:40 +00:00
Axel Spoerl
8e6ede7cd1 Stabilize tst_QSpinBox::sizeHint() by explicitly calling setLayout()
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>
2022-12-26 22:49:53 +01:00
Bartlomiej Moskal
02f1e72d5a Android: Set EnterKeyNext as default type for QLineEdit
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>
2022-12-21 04:11:58 +01:00
Axel Spoerl
5edb71c6d4 Fix QWidget::restoreGeometry when restored geometry is off screen
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>
2022-12-16 22:58:11 +01:00
Volker Hilsheimer
f89c948c0c QHeaderView test: Remove unused variables
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>
2022-12-12 20:10:11 +01:00
Edward Welbourne
2f440169c0 Adapt to QTimeZone replacing Qt::TimeSpec usage
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>
2022-12-10 06:39:44 +01:00
Edward Welbourne
5da038ab51 Port QDateTimeEdit internals to QTimeZone
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>
2022-12-09 16:16:48 +01:00
Volker Hilsheimer
c95de359b4 QComboBox: Don't dereference potential nullptr, simplify
Amends a874087504, 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>
2022-12-08 15:14:17 +01:00
Volker Hilsheimer
7956d9e060 Deliver tablet events to the toplevel widget if there is no child
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 ea615b421b and
8fd6cef372.

Pick-to: 6.4
Fixes: QTBUG-108747
Change-Id: I79050f1e063931e439945f64b50712dcc1ecb18c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-12-02 23:10:05 +00:00
Axel Spoerl
acb012558b Cleanup tst_QWidget BLACKLIST file
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>
2022-12-02 19:53:01 +00:00
Axel Spoerl
2ec7a6322f Stabilize tst_QWidget::optimizedResizeMove and optimizedResize_topLevel
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>
2022-12-02 11:45:36 +01:00
Axel Spoerl
84d4b21f69 Stabilize tst_QComboBox::setPalette() with simple palettes
The test function tst_QComboBox::setPalette() tests if the QComboBox
correctly inherits its palette to its QLineEdit child, by directly
comparing both palettes after a palette change on the QComboBox.

If the application palette for both widget types contains brushes which
are either pixmap based or the resolve mask prevents them from being
copied, the direct palette comparison between parent and child fails,
despite of a correct propagation.

This patch sets a simple gray application palette for QComboBox and
QLineEdit at the beginning of the test. The QSKIP for macOS is
removed, because using simple palettes solves both issues.


Change-Id: I61d509745377306d6f8331dfc1ac189fc58cdedb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-30 22:11:12 +01:00
Tor Arne Vestbø
a9005a70d5 Blacklist tst_QWidget::showMinimizedKeepsFocus on macOS 13 in CI
It started being recorded as flakey after making macOS 13 a significant
config in the CI, but it's unclear why the test was not failing during
the nightly testing leading up to that.

  http://testresults.qt.io/grafana/goto/-AzSwMKVz

It has also been blacklisted on macOS many times in the past.

Change-Id: I7be5fefb3669e9643a98d2ac82059bf0576c6d5c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-30 18:01:47 +01:00
Axel Spoerl
58b1984efc Stabilize tst_QWidgetRepaintManager on XCB platforms
When a widget's palette has different brushes in Active / Inactive
color groups, or it is pixmap based, multiple paint events are
triggered. This leads to unpredictable, double entries in
QWidgetRepaintManager::dirtyWidgetList().

This patch overrides event() of all test widgets and ignores
activation / deactivation events in order to make the entries of
QWidgetRepaintManager::dirtyWidgetList() predictable.

Pick-to: 6.4
Change-Id: I164d7ab4148551590ac3c50fcc3b9f98c5ac0535
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-30 14:48:51 +01:00
Axel Spoerl
8071e3c2af Blacklist tst_QWidgetRepainManager functions flaking on XCB
QXcbBackingStore::toImage() returns a QImage that differs from what
is displayed on the screen: After multiple moves of children within
their parent widget, the last move is not always properly reflected
on openSuSE 15.4.

This patch blacklists the test functions fastMove, moveAccross and
moveInOutOverlapped on openSuSE Leap.

Task-number: QTBUG-109036
Pick-to: 6.4
Change-Id: Ideb505570df090b25d30762492d9c60beb6641ff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-30 14:48:51 +01:00
Marc Mutz
c72bf262ea Introduce QT_NO_AS_CONST and mark QtBase free of it
Change-Id: I680086e767fe6d5c69eb7103b26150293c69b175
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-27 17:14:28 +01:00
Axel Spoerl
612c8e428e Set simplePalette on staticWidget in tst_QWidget::optimizedResizeMove
It was forgotten to assign a simple palette to this object in
1576f82721

This patch adds the missing line.

Pick-to: 6.4
Change-Id: I0acf765d9646ecc8d49791d96b5ea910e11997fe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-27 16:49:35 +01:00
Taras Kachmaryk
f0cd18706f QGraphicsView: fix jumping graphic items when dragging out of view
The algorithms for calculating the scene's position within the view
did not compensate for scrollbars showing. The scrollbars should be
ignored when positioning hte scene within the view, as alignment
only cares about the positioning of the scene when the view is
larger than the scene anyway.

Add a test case that verifies that items don't jump up or down when
dragging horizontally, and not left or right when dragging
vertically.

Mark variables in the modified function as const where applicable to
make it easier to follow the code.

Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Fixes: QTBUG-46757
Change-Id: If205637dfe124e0034f68201b23f174d6863084d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-26 16:07:15 +02:00
Axel Spoerl
1576f82721 Add simple palette to tst_QWidget
When a widget's palette has different active / inactive colors,
multiple paint events can occur. This makes tst_QWidget functions fail
when they expect a spcific amount of paint events and the platform
theme provides a palette with active / inactive differences.

This patch adds a function to populate test widgets with a simple
palette, to prevent multiple paint events.

Pick-to: 6.4
Change-Id: If9b2faedcc5ca87ba24991cedd5e4ac927b02644
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-26 08:07:39 +01:00
Axel Spoerl
f7089e691e Handle multiple paint events in tst_QWidgetRepaintManager
The helper function TestWidget::waitForPainted returned after the test
widget had consumed the first paint event. In case of multiple paint
events, QRegion paintedRegions did not match the entire region that
was supposed to be painted. The test function children() failed/flaked
due to that.

This patch extends the helper function. After consumption of the first
paint event, it processes events until the painted regions no longer
change.

Pick-to: 6.4
Fixes: QTBUG-108764
Change-Id: I54e14bb07725dd1f602cc93085da13836e3b7494
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-25 00:05:48 +01:00
Axel Spoerl
5f330d9fed Blacklist tst_QOpenGLWidget on Ubuntu, RHEL and OpenSuSE
tst_QOpenGLWidget fails on Linux when other windows on the desktop grab
focus. That can happen on CI VMs.

This patch blacklists the test on Linux as a temporary solution

Task-number: COIN-966
Change-Id: Ibdd7e626f92d2da692bd7c44741e0ca4c9dbd1a8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-11-24 09:06:50 +00:00
Tor Arne Vestbø
a47c7a9826 macOS: Add dialog helper for native message boxes
The native implementation uses NSAlert, making a best effort to map the
QMessageBox properties to the native dialog, falling back to the cross
platform non-native dialog if the discrepancy is too big.

The initial implementation focuses on the current state of the
native dialog helper "protocol", but there's room for improvement
here, which would allow even more dialog types and properties to
be native.

[ChangeLog][macOS] Message boxes such as QMessageBox now follow
the platform look and feel by using native dialogs if possible.

Change-Id: I4da33f99894194a7b301628cd1fbb44d646ddf18
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-11-15 20:36:17 +01:00
Samuel Mira
35cd0db935 Android: Skip/blacklist remaining tests for emulator bump to API 24
Skip on crashing tst_qvulkan test
Blacklisted completer_data on qfiledialog
(8d76c5af51 should have been enough but
it is still failing)

Task-number: QTBUG-108328
Task-number: QTBUG-108329
Change-Id: Iad5573af60cca16d16ba0462293e276186e25653
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-11-15 01:01:54 +00:00
Laszlo Agocs
244daf4cfc Fix rhi flush eval perf. and native window problems
This effectively reverts a4a51f6a64
while solving the problem that change intended to fix by an
alternative approach: Swap the order of checks for rhi-based
flushing. Checking the widgets' wishes first was a mistake.  We should
first check what is forced, e.g. via the env.vars.  Then only move on
investigating the child widget hierarchy if there was nothing specific
requested.

This way having a QOpenGLWidget in a window and running with
QT_WIDGETS_RHI=1 QT_WIDGETS_RHI_BACKEND=vulkan will prioritize the
forced request (Vulkan) and so the QOpenGLWidget will gracefully not
render anything while printing the expected warning to tell what's
going on.

The expensive recursion plaguing the construction of larger widget
hierarchies is now avoided, that should no longer take seconds due to
walking the entire widget hierarchy of the top-level window every time
a new widget is added to it.

However, this then uncovered a set of problems concerning native child
widgets. The repaint manager seems to have an obvious mistake where
the usage of rhi (and so textures and whatnot) is decided based on
'widget' (which is either a top-level or a native child) instead of
'tlw' (which is the top-level with the backingstore). The usesRhiFlush
flag only really matters for a real top-level, not for native child
widgets.  The rhi-based flushing is tied to the backingstore, and the
backingstore comes from the top-level widget.

Finally, make the qopenglwidget autotest to actually exercise
something when it comes to QOpenGLWidgets (or their ancestors) turned
native.  The original code from a long time ago does not really test
native child widgets, because it turns the top-level into native which
is quite superfluous since the toplevel is backed by a native window
(and a backingstore) anyway.

Pick-to: 6.4
Task-number: QTBUG-105017
Fixes: QTBUG-108344
Fixes: QTBUG-108277
Change-Id: I1785b0ca627cf151aad06a5489f63874d787f087
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-14 11:05:48 +01:00
Axel Spoerl
efb7463656 Add comment to tst_QWidget::saveRestoreGeometry() for debugging
saveRestoreGeometry() somtimes creates a 29px offset when debugged in
Qt Creator, which makes the test fail.

This patch adds a code comment to make developers aware of this fact.

Pick-to: 6.2 6.4
Change-Id: I920bd02eb7543faf8b25a0a242b888f3a3745e2a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-11-11 17:48:51 +01:00
Axel Spoerl
99aadcad5e Stabilize flakiness in tst_QWidget::multipleToplevelFocusCheck()
multipleToplevelFocusCheck() occasionally failed on XCB because
QApplication::activeWindow() was nullptr immediately after
qWaitForWindowActive() returned true.

This patch replaces QCOMPARE on QGuiApplicaiton::activeWindow() with
QTRY_COMPARE in order to continue spinning the event loop until the
condition has been met. It adds QWidget::activateWindow after show()
to ensure focus is acquired also when another window has received
focus in the meanwhile.

Pick-to: 6.2 6.4
Change-Id: If84eb8b77c5a6b16af271334a1fe5eb92c05644b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-11-11 17:48:51 +01:00
Axel Spoerl
a45a1b8674 Stabilize flakiness in tst_QWidget::raise()
The test function raise() occasionally failed because of unexpected
paint events being counted.

This is due to a QTRY_VERIFY returning after consumption of the first
paint event. If more than one paint event got posted, it will be
delivered and counted when no more paint events are expected.

This patch ensures that all paint events are consumed before resetting
the count and expecting no more paint events.

Fixes: QTBUG-68175
Pick-to: 6.2 6.4
Change-Id: I3e91a34e851da4bd01c7429e824d2b9101077a06
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-11-11 17:48:50 +01:00
Tor Arne Vestbø
d5f92c1fb8 Remove unused tst_qfontdialog_mac_helpers.mm
The uses of the click_cocoa_button() function was removed in 2012,
in ba21ca7b5b.

Change-Id: If7abfc56bb307cfbf9f6628cec9c7267a8a1f31f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-11-11 17:48:50 +01:00