Fix transforms for things with RenderPointerListeners (#32535)

This fixes #32525, because it now marks the compositing bits as needing to be recalculated if the mouse tracker changes its idea of whether or not a mouse is attached.

This bug occurred because the test framework was leaking state from one test to the next (the state about whether a mouse pointer was active), and so even though there was a "passing" test when run in order with the other tests in the file, when the test was run individually (or first), it would have failed and caught the bug.

This adds an assert to make sure that after each test there are no simulated mouse pointers connected, and now calls removePointer in all of the tests where this was a problem.
This commit is contained in:
Greg Spencer
2019-05-13 15:48:12 -07:00
committed by GitHub
parent f5cf209a66
commit a5053bfb29
7 changed files with 66 additions and 10 deletions

View File

@@ -695,6 +695,10 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
_pendingExceptionDetails = null;
_parentZone = null;
buildOwner.focusManager = FocusManager();
assert(!RendererBinding.instance.mouseTracker.mouseIsConnected,
'The MouseTracker thinks that there is still a mouse connected, which indicates that a '
'test has not removed the mouse pointer which it added. Call removePointer on the '
'active mouse gesture to remove the mouse pointer.');
}
}

View File

@@ -102,6 +102,7 @@ class TestPointer {
return PointerDownEvent(
timeStamp: timeStamp,
kind: kind,
device: _device,
pointer: pointer,
position: location,
);
@@ -125,6 +126,7 @@ class TestPointer {
return PointerMoveEvent(
timeStamp: timeStamp,
kind: kind,
device: _device,
pointer: pointer,
position: newLocation,
delta: delta,
@@ -143,6 +145,7 @@ class TestPointer {
return PointerUpEvent(
timeStamp: timeStamp,
kind: kind,
device: _device,
pointer: pointer,
position: location,
);
@@ -160,6 +163,7 @@ class TestPointer {
return PointerCancelEvent(
timeStamp: timeStamp,
kind: kind,
device: _device,
pointer: pointer,
position: location,
);
@@ -225,8 +229,8 @@ class TestPointer {
return PointerHoverEvent(
timeStamp: timeStamp,
kind: kind,
position: newLocation,
device: _device,
position: newLocation,
delta: delta,
);
}
@@ -246,6 +250,7 @@ class TestPointer {
return PointerScrollEvent(
timeStamp: timeStamp,
kind: kind,
device: _device,
position: location,
scrollDelta: scrollDelta,
);