qtdeclarative/tests
Richard Moe Gustavsen 571c407ea6 DA: align delivery of mouse, touch, and synthesized mouse events to childMouseEventFilter
Currently the delivery of pointer events to childMouseEventFilters
differs depending on if the event is a mouse, touch, or synthesized
mouse event. If case of a mouse event, it will be sent to all the
filters up the parent chain, even if one of the filters along the
way returns true. If it's a touch event, propagation will stop as
soon as a filter returns true.

What does it mean that childMouseEventFilter returns true?
According to tst_QQuickWindow::testChildMouseEventFilter(), if
a childMouseEventFilter returns true, the event should be stopped
from being sent to the receiver, and only the receiver. It should
not be stopped from propagating to other childMouseEventFilters
up the parent chain. This is explicitly tested with data
row "r1 rejects and filters".

Therefore, in order to make testChildMouseEventFilter() pass, not
only for mouse events, but also for touch and synthesized mouse
events, this patch will make the following changes:

1) Remove the early 'return' statement after a touch event was
filtered by a childMouseEventFilter. This will make sure that the
touch event will continue to propagate to parent
childMouseEventFilters, equal to how it works for mouse and
synthesized mouse events.

2) For both touch-, and synthesized mouse events, we deliver a
(localized) copy of the original touch event to
childMouseEventFilter(). The filter can then choose to accept
or ignore this copy. But as it stood, we would never sync back
the accept state from the copy to the original event. The result
was that the original event would continue to propagate, regardless
of accepted state set by the filter. This patch will therefore
sync the accepted state from the copy back to the original event,
when the event is filtered. This will make sure that if a filter
e.g ignores the event, the receiver will not receive the event
(since it was filtered), and the event will propagate to the
parent (since it was ignored). Which is equal to how it works
for mouse events.

3) For both touch and synthesized mouse events, we used to always
set an exclusive grab on the affected event points if a
childMouseEventFilter filtered an event. This is different from
mouse event delivery, where we only set a grab when the event is
also accepted. And the latter is also (most likely) the correct thing
to do; If the event is ignored, it means that the filter says (on
behalf of the receiver) that it doesn't want the event. And it
doesn't make sense then (AFAICS) to still grab the event points.
This patch will therefore, equal to mouse event delivery, ensure
that we only give a filter an exclusive grab on the touch points
when the event was actually accepted.

With these changes applied, we then also change the
tst_qquickwindow::testChildMouseEventFilter() to run three times,
once for mouse event, touch events, and synthesized mouse events,
to verify that they're all aligned.

Fixes: QTBUG-115953
Pick-to: 6.7 6.6 6.5
Change-Id: I8b5b1faadc907e804b7e21c667888db7cfe28872
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-01-24 17:12:57 +01:00
..
auto DA: align delivery of mouse, touch, and synthesized mouse events to childMouseEventFilter 2024-01-24 17:12:57 +01:00
baseline Fix intersections that coincide with a vertex 2024-01-18 11:12:30 +01:00
benchmarks DOM refactoring. Move loadPendingDependencies to DomEnvironment 2024-01-18 18:46:18 +01:00
global
libfuzzer/qml
manual windowembedding: Remove workaround for wrongly placed qmldir file 2024-01-20 11:51:03 +01:00
system
testapplications Port sticky.qml manual test to Controls 2 2023-07-21 00:56:03 +02:00
CMakeLists.txt qmlls: build and run tests in CI 2023-11-01 21:30:45 +01:00
README

README

This directory contains autotests and benchmarks based on QTestlib. In order
to run the autotests reliably, you need to configure a desktop to match the
test environment that these tests are written for.

Linux X11:

   * The user must be logged in to an active desktop; you can't run the
     autotests without a valid DISPLAY that allows X11 connections.

   * The tests are run against a KDE3 or KDE4 desktop.

   * Window manager uses "click to focus", and not "focus follows mouse". Many
     tests move the mouse cursor around and expect this to not affect focus
     and activation.

   * Disable "click to activate", i.e., when a window is opened, the window
     manager should automatically activate it (give it input focus) and not
     wait for the user to click the window.