-
Notifications
You must be signed in to change notification settings - Fork 9.7k
fix pointer events by setting TestBindingEventSource #3168
Conversation
|
@ferhatb This is the PR which will fix scroll for PR flutter/engine#21928 |
dnfield
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test that would fail without this change?
Also, I'm a bit surprised that we'd need this on we but not on desktop or mobile. Why is that?
|
I'm not sure about mobile or desktop actually that's why I only set web. Any opinion if the device
This happens when we generate MouseEvents via dart:html. I will add a web tests, I don't know how mobile/desktop generate PointerEvents for testing purposes therefore I'm not sure if they will have the same issue. |
Added a test for incrementing the counter by dispatching events. PHAL! |
dnfield
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
We can worry about whether desktop platforms need this later, since it's not clear yet to me that they would.
|
|
||
| // Verify that counter is clicked. | ||
| expect(finder, findsOneWidget); | ||
| expect(counter.data, '1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, can we assert earlier that this is '0'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! I'll make the change thanks :)
|
I'm a little confuse dabout the error in CI - why isn't it finding the super method when building? |
dnfield
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
| super.handlePointerEvent(pointerEvent, | ||
| source: TestBindingEventSource.test); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: trailing comma.
Why aren't we doing this in other test bindings? What's special about this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added the other tests binding and update the comments. Fixing the assert statements didn't help since WidgetTester.dispatchEvent (code) is not acting on the gesture bindings, using TestBindingEventSource.device does not generate the expected results for a gesture.
TestBindingEventSource.test uses RenderBinding.dispatchEvent: https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/rendering/binding.dart#L271
bba3cde to
665bc59
Compare
|
@dnfield fixing the assert statements for PointerAdd/PointerRemove didn't help since the dispatchers used for the Btw, looks like flutter driver is not working with integration_test package anymore, what is the quick solution we have? @ferhatb has a code that we need to get in (which uses scroll gestures) |
|
Stable channel tests do not pass since the method we are using |
|
Since |
Description
Web integration tests were failing for MousePointer events. This PR is fixing this by setting
TestBindingEventSourcetoTestBindingEventSource.testfor web integration_tests.Related Issues
Fixes flutter/flutter#68502
Tests
Tests are added to test the pointer gestures.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?