-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix how tests count open SemanticsHandles #121571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 removed this since SemanticsTester is not actually part of the public API. So, the hint could be a little confusing.
chunhtai
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, just some nits
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 assume this would change when there may be multiple pipeline owners?
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.
Yeah.
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 assume this change is to verify the new counting logic work correctly, should we create a new test instead of modifying the existing 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.
Added a test. Turns out, the logic was previously untested and contained a bug. Now some more tests that fail to clean up their semantics handle are failing. I'll have to look into that tomorrow.
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.
Done. Could you take another look at the new tests and the fixes?
4a2d301 to
d024afc
Compare
d024afc to
39e5314
Compare
chunhtai
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, just some concern about removing the usage of teardown.
| group('Semantics', () { | ||
| testWidgets('day mode', (WidgetTester tester) async { | ||
| final SemanticsHandle semantics = tester.ensureSemantics(); | ||
| addTearDown(semantics.dispose); |
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.
This is surprising. I always thought this was the better way to dispose resource
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.
Yeah, but the way our checks currently work they don't play nice with that. We should probably fix that at some point.
Follow-up to #121289.
Part of #121573.
Properly count the open semantics handles in tests. In an ideal world we'd not have the PipelineOwner API for creating semantics handlers and would only be concerned about SemanticsHandlers created via the Binding. However, for backwards compatibility, we will also count the PipelineOwner handles for now (until we eventually deprecate that API).
This change also fixes the leak detection to work properly. Previously, it had an off by one error and was missing leaks. Tests have been added to prevent this in the future.