Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented Jun 15, 2021

Fixes flutter/flutter#27628

Moves all of those tests to the ui_unittests program. Creates a stub test that allows dart code to call an arbitrary private hook and do whatever checks it needs. No more needing to fake dart:ui and mirror exactly oddities it has, like whether or not or how it's versioned. The final straw on this for me was when I was working on migrating other tests to null safety and found I could not remove dart version hints from dart:ui files because of this test.

@pragma('vm:entry-point')
void hooksTests() {
void test(String name, VoidCallback testFunction) {
print(name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid printing unless the test fails? (ideally tests would have no output except to report failures or to say that all the tests passed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -1,4 +1,3 @@
// @dart = 2.6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a README to the fixtures directory that explains what it's for? (i'm assuming it's for development-time resources that don't end up in production binaries, but it's not clear exactly how we enforce that or why they are here rather than, say, in the testing directory)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These directories exist in several places - the way that the C++ unit test setups work, the fixtures directory contains a Dart file and sometimes other data files like images for testing.

See also for example //shell/fixtures/shell_test.dart.

There's a GN template that defines how this works called test_fixtures that has a bunch of commentary on it: https://github.com/flutter/engine/blob/master/testing/testing.gni#L230-L250

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That commentary never actually says what it means by "fixtures". I'm also not sure how I'd ever find that if I started from a fixtures directory. Having some breadcrumbs would really help people orient themselves when first being exposed to this stuff, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a readme explaing a bit and pointing to the BUILD file and the template.

@chinmaygarde
Copy link
Contributor

@Hixie I think your comments are addressed. Another review pass?

@Hixie
Copy link
Contributor

Hixie commented Jun 17, 2021

My comments were just drive-by comments, I have no opinion on the overall change here.

@dnfield dnfield requested a review from gspencergoog June 17, 2021 21:43
@chinmaygarde
Copy link
Contributor

@dnfield The README is empty. Did you perhaps not stage the contents?

Copy link
Contributor

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the README being empty, LGTM.

@dnfield
Copy link
Contributor Author

dnfield commented Jun 17, 2021

Hah, forgot to save the buffer before committing. Fixed that. Thanks for the review.

@dnfield dnfield added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jun 17, 2021
@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite licenses_check has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jun 17, 2021
@dnfield dnfield added waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. tech-debt Technical debt, code quality, testing, etc. labels Jun 17, 2021
@fluttergithubbot fluttergithubbot merged commit 6de6428 into flutter:master Jun 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 20, 2021
wqyfavor pushed a commit to wqyfavor/engine that referenced this pull request Jun 21, 2021
moffatman pushed a commit to moffatman/engine that referenced this pull request Aug 5, 2021
naudzghebre pushed a commit to naudzghebre/engine that referenced this pull request Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes tech-debt Technical debt, code quality, testing, etc. waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

window_hooks_integration_test.dart shouldn't fake being part of dart:ui

4 participants