-
Notifications
You must be signed in to change notification settings - Fork 6k
Add mock capability to PerformanceOverlayLayer #7537
Conversation
To avoid regression like flutter#26387 Need flutter/engine#7537 to land first.
|
Ping... |
|
I am not comfortable having mock data present in the file itself. Can you make the layer accept data to display (instead of collect it on its own) and have the unittest supply said data? |
So we can do golden test on PerformanceOverlay to avoid regression like flutter/flutter#26387
bfb78a3 to
1aaf894
Compare
|
@chinmaygarde : now the unittest supply the data. |
|
Ping... |
chinmaygarde
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.
I feel like I did not do an adequate job of conveying my objection initially. The code as it reads currently has explicit logic in all build modes to deal with mock data. My expectation to the amendments suggested in previous comments were something closer to having the stopwatch be constructed using mock data and have the stopwatch definition be supplied (by the test) to the overlay layer.
Now, obviously, you cannot create a stopwatch using the test harness you are currently using (as it is an integration test with Dart code). To work around this limitation, you have had to add a lot code to plumb this data from the test specification in Dart all the way to down to the overlay layer. The Dart code does not need or care about this in normal operation. This, I believe, is because of the use of the wrong test harness to test this functionality.
A more explicit suggestion would be:
- Allow stopwatches to be created using lap information upfront.
Stopwatch(std::vector<fml::TimeDelta> laps); - Create a new unit test in
flow_unitteststhat creates a performance overlay layer and paints the same using a stopwatch with mock data (specified in the test). - Compare the snapshot with a fixture.
|
@chinmaygarde now it's a pure C++ unit test without any changes to the framework or flow layers. My current concern is how easy we can port this test to Android/iOS unit test once we have a device lab golden test. I think that we can worry about this later if you find the current approach Ok. |
67c7541 to
8d35232
Compare
|
@chinmaygarde @Hixie golden test the performance overlay will run into font rendering mismatch issues in different Linux versions. My current solution is to use our Docker container which ensures the identical environment as our presubmit checks. Please let me know your comments. |
|
I don't have an opinion on the approach here. FWIW, in other situations we avoid the font issue by using the "Ahem" font, which is carefully designed to be predictable and identical everywhere. |
|
Ok, I modified PerformanceOverlayLayer so it can take an additional font_path parameter. Now I found that specifying "Roboto-Regular" is sufficient to make sure that pixels match. This is a little better than "Ahem" because we can see more meaningful texts in the golden image. I guess that we don't have to worry too much about the font rendering since this font is just for this specific test only. |
|
Ping... |
|
Ping @chinmaygarde ... |
|
Ahh it looks like the file is there, but the engine recipe has the tests running from the We need to either let the file come in as a parameter or maybe copy it over as part of a build step, or edit the recipe to run this specific test in the correct directory (but I'd rather avoid modifying the recipe for this). |
|
In the mean time I'm going to revert this to un-red the bots. |
flutter/engine@7c70240...90569e8 git log 7c70240..90569e8 --no-merges --oneline 90569e8 Provide public api to allow FlutterEngine related context to be destoryed (flutter/engine#7610) 693645e Revert "Add mock capability to PerformanceOverlayLayer (#7537)" (flutter/engine#7765) d130f15 Add x bit to some python scripts (flutter/engine#7764) 2146cde Roll src/third_party/skia 706a7cd1e826..87461aad7285 (1 commits) (flutter/engine#7763) 2a648b9 Roll src/third_party/skia be39f713e530..706a7cd1e826 (4 commits) (flutter/engine#7761) 68396ae Throttle picture raster cache (flutter/engine#7759) a6753b0 Roll src/third_party/dart 52f5e34dbf..174d6fec3d (12 commits) f9252e7 allow specifying out directory root (flutter/engine#7753) 12d0b95 Don't call OnAnimatorNotifyIdle if a frame is scheduled (flutter/engine#7746) 5f3f3bd Add mock capability to PerformanceOverlayLayer (flutter/engine#7537) 7d97afd Roll src/third_party/skia 37064c1739f3..be39f713e530 (7 commits) (flutter/engine#7757) 3bfd265 Add flutter config to macOS targets (flutter/engine#7756) 4d3a112 Document GPUSurfaceGLDelegate methods and move it to its own file. (flutter/engine#7755) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff ([email protected]), and stop the roller if necessary.
flutter/engine@7c70240...90569e8 git log 7c70240..90569e8 --no-merges --oneline 90569e8 Provide public api to allow FlutterEngine related context to be destoryed (flutter/engine#7610) 693645e Revert &flutter#34;Add mock capability to PerformanceOverlayLayer (flutter#7537)&flutter#34; (flutter/engine#7765) d130f15 Add x bit to some python scripts (flutter/engine#7764) 2146cde Roll src/third_party/skia 706a7cd1e826..87461aad7285 (1 commits) (flutter/engine#7763) 2a648b9 Roll src/third_party/skia be39f713e530..706a7cd1e826 (4 commits) (flutter/engine#7761) 68396ae Throttle picture raster cache (flutter/engine#7759) a6753b0 Roll src/third_party/dart 52f5e34dbf..174d6fec3d (12 commits) f9252e7 allow specifying out directory root (flutter/engine#7753) 12d0b95 Don&flutter#39;t call OnAnimatorNotifyIdle if a frame is scheduled (flutter/engine#7746) 5f3f3bd Add mock capability to PerformanceOverlayLayer (flutter/engine#7537) 7d97afd Roll src/third_party/skia 37064c1739f3..be39f713e530 (7 commits) (flutter/engine#7757) 3bfd265 Add flutter config to macOS targets (flutter/engine#7756) 4d3a112 Document GPUSurfaceGLDelegate methods and move it to its own file. (flutter/engine#7755) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff ([email protected]), and stop the roller if necessary.
…er#7537)" (flutter#7765)" This reverts commit 693645e.
So we can do golden test on PerformanceOverlay to avoid regression like flutter/flutter#26387