Repository navigation
test: Refactor scrollbar tests to no longer depend on material - #185396
Conversation
Move two testWidgets that use MaterialApp/Scaffold/DatePickerDialog/ ElevatedButton from test/widgets/scrollbar_test.dart into test/material/scrollbar_test.dart where they belong. Replace flutter/material.dart import with flutter/widgets.dart in the widgets test file since the moved tests were the only Material usages. Part of flutter#177412
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request moves two regression tests regarding scrollbar precision and dynamic controller assignment from the widgets test suite to the material test suite, while also updating an import in the widgets test file. A minor grammatical correction was suggested for one of the test descriptions to improve readability and clarity.
|
Thank you for the review, @gemini-code-assist! Grammar fix: Fixed — the test description now reads |
|
Thanks for the update, @shivanshu877. The grammar fix looks good. I have no further comments on this pull request. |
justinmc
left a comment
There was a problem hiding this comment.
Thanks for the PR, left a comment below about one test that maybe should be refactored instead of moved.
…erial Per @justinmc's review on flutter#185396, the RawScrollbar regression test exercises pure widget-level behavior (assigning a controller with thumbVisibility true in the same frame) and only used Material because the original repro used an ElevatedButton to trigger setState. This commit: * Moves the test back to packages/flutter/test/widgets/scrollbar_test.dart * Replaces ElevatedButton with a GestureDetector wrapping a SizedBox so the test no longer needs Material to compile or run. The DatePickerDialog precision-error test stays in test/material/ since it genuinely exercises Material behavior.
justinmc
left a comment
There was a problem hiding this comment.
LGTM 👍. Thanks for helping out with this effort!
|
Heads up there is an analyzer failure. |
The analyzer flagged a directives_ordering lint on line 9 of test/widgets/scrollbar_test.dart — the package:flutter imports were not alphabetically sorted (foundation, widgets, src/physics/utils instead of foundation, src/physics/utils, widgets). Reordered the three imports so they're alphabetical.
…shu877/flutter into fix/177412-legacy-imports
|
Thanks for the LGTM @justinmc! Fixed the analyzer failure in commit 3c4ed1d — the lint was a directives_ordering issue (the three package:flutter imports in widgets/scrollbar_test.dart weren't alphabetical). Reordered to foundation → src/physics/utils → widgets. |
|
@victorsanni @justinmc — your approvals were dismissed by the analyzer-fix push (commit 3c4ed1d). The only change since the previous approvals is the one-line directives_ordering reorder in widgets/scrollbar_test.dart (foundation → src/physics/utils → widgets). |
|
Thank you for the explanation (and sorry for the late response)! Correct me if I'm wrong because the diff of
I don't see a total of 5 move tests here. Is it possible that the changes have been implemented by other PRs? Anyway, the remaining changes here are still valuable, and I appreciate you for making them. The current idea is that, we'll no longer land changes to My suggestion is as follows:
If there are other cross-import issues or misplaced tests, you're welcome (and appreicated) to submit them together or in separate PRs. Thank you again! |
…-imports # Conflicts: # dev/bots/check_tests_cross_imports.dart
Reverts packages/flutter/test/material/scrollbar_test.dart, which drops both the addition of the precision-error test and the reformatting churn in that file. What remains is the refactor of the RawScrollbar dynamic controller test off material, the removal of the precision-error test from widgets/, and the matching knownWidgetsCrossImports entry. The addition of the precision-error test goes to material_ui in flutter/packages instead, per the material freeze in flutter#188444.
|
You're right — only one test actually moves. The other four ( Reshaped as you suggested: reverted I'll send the addition of the precision-error test to |
Description
Moves two
testWidgetsthat useMaterialApp,Scaffold,DatePickerDialog, andElevatedButtonout oftest/widgets/scrollbar_test.dartintotest/material/scrollbar_test.dartwhere they belong.Also replaces the
package:flutter/material.dartimport in the widgets test file withpackage:flutter/widgets.dart, since those moved tests were the only Material usages.Tests
All existing tests continue to pass:
packages/flutter/test/widgets/scrollbar_test.dart— 99 tests passpackages/flutter/test/material/scrollbar_test.dart— 51 tests pass (includes the 2 moved tests)Related Issues
Part of #177412