Skip to content
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

[Material] Unit test for skipping Slider tick mark due to overdensity #28013

Merged
merged 16 commits into from Feb 26, 2019

Conversation

clocksmith
Copy link
Contributor

Adding a unit test for skipping over dense tick marks and updating the previous hot fix with better style.

Copy link
Member

@rami-a rami-a left a comment

Choose a reason for hiding this comment

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

LGTM

packages/flutter/test/material/slider_test.dart Outdated Show resolved Hide resolved
Copy link
Contributor

@johnsonmh johnsonmh left a comment

Choose a reason for hiding this comment

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

LGTM

@zoechi zoechi added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Feb 17, 2019
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

Looks good, just some small stuff


Widget buildSlider({
int divisions,
TextDirection textDirection,
Copy link
Contributor

Choose a reason for hiding this comment

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

This parameter isn't needed

max: 100.0,
divisions: divisions,
value: value,
onChanged: (double newValue) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Simplify for this test, since we're not moving the slider:

onChanged: (double value) { },

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

@@ -978,6 +978,63 @@ void main() {
await tester.pumpAndSettle();
});

testWidgets('Tick marks are skipped when they are too dense', (WidgetTester tester) async {
double value = 25.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed for this test

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

),
);

// No tick marks because they are too dense, just a thumb.
Copy link
Contributor

Choose a reason for hiding this comment

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

The failure mode we've seen has divisions = max - min (100). Would be best to duplicate that here to make sure we're not regressing a case that we've seen fail. We can assume that if 100 is too dense 500 will be too :-)

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 and added comment

}) {
return Directionality(
textDirection: textDirection,
child: StatefulBuilder(
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't need a StatefulBuilder, since we don't actually need to maintain the slider's value.

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

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

@clocksmith clocksmith merged commit 70c8b63 into flutter:master Feb 26, 2019
@clocksmith clocksmith deleted the slider-tick-density-fix branch September 12, 2019 16:55
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants