[go: nahoru, domu]

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

Add tests for color_filtered.0.dart example. #151064

Merged

Conversation

ksokolovskyi
Copy link
Contributor

This PR contributes to #130459

Description

  • Adds tests for examples/api/lib/widgets/color_filter/color_filtered.0.dart

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Jun 30, 2024
HttpOverrides.global = null;
});

testWidgets('Displays two images', (WidgetTester tester) async {
Copy link
Member
@TahaTesser TahaTesser Jul 1, 2024

Choose a reason for hiding this comment

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

These 3 tests can be just one clear and concise test.

"'Displays two images" test - you're already finding first and last images the implies there are only two images.

"'Applies red color filter with modulate blend mode to the first image" & "Applies grey color filter with saturation blend mode to the second image" - These two are short and verbose tests. We can add single test with "Color filter is applied to the images" and explain the difference in the test comment instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TahaTesser thanks for the review and great suggestion. I applied it in the latest commit.


final RenderObject renderObject = tester.firstRenderObject(
final RenderObject renderObject1 = tester.firstRenderObject(
Copy link
Member

Choose a reason for hiding this comment

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

We can remove final and reassign the value, this also ensures that we have updated expected values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, maybe I am missing something, but how does this ensure we have updated the expected values?

find.byType(ColorFiltered).first,
);
final ColorFilterLayer colorFilterLayer =
renderObject.debugLayer! as ColorFilterLayer;
final ColorFilterLayer colorFilterLayer1 =
Copy link
Member

Choose a reason for hiding this comment

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

We can remove final and reassign the value, this also ensures that we have updated expected values.

// Verify that two images are displayed.
expect(find.byType(Image), findsNWidgets(2));

final RenderObject renderObject1 = tester.firstRenderObject(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
final RenderObject renderObject1 = tester.firstRenderObject(
RenderObject renderObject = tester.firstRenderObject(

equals(const ColorFilter.mode(Colors.red, BlendMode.modulate)),
);

final RenderObject renderObject2 = tester.firstRenderObject(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
final RenderObject renderObject2 = tester.firstRenderObject(
renderObject = tester.firstRenderObject(

Earlier we found render object for the first image, here we assign the variable to expect a different value.

@ksokolovskyi ksokolovskyi force-pushed the add-color-filtered-example-tests branch 3 times, most recently from b957b99 to 7a8e7b7 Compare July 1, 2024 21:17
Copy link
Member
@TahaTesser TahaTesser left a comment

Choose a reason for hiding this comment

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

LGTM

@ksokolovskyi ksokolovskyi force-pushed the add-color-filtered-example-tests branch 2 times, most recently from 23c769e to 531d935 Compare July 2, 2024 17:43
Copy link
Contributor
@bleroux bleroux left a comment

Choose a reason for hiding this comment

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

LGTM!

@ksokolovskyi ksokolovskyi force-pushed the add-color-filtered-example-tests branch from 531d935 to 974bfa2 Compare July 3, 2024 12:02
@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 5, 2024
@auto-submit auto-submit bot merged commit bff1568 into flutter:master Jul 5, 2024
138 checks passed
@ksokolovskyi
Copy link
Contributor Author

@TahaTesser @bleroux thanks for the review!

TahaTesser pushed a commit to TahaTesser/flutter that referenced this pull request Jul 8, 2024
This PR contributes to flutter#130459

### Description
- Adds tests for `examples/api/lib/widgets/color_filter/color_filtered.0.dart`
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 8, 2024
victorsanni pushed a commit to victorsanni/flutter that referenced this pull request Jul 8, 2024
This PR contributes to flutter#130459

### Description
- Adds tests for `examples/api/lib/widgets/color_filter/color_filtered.0.dart`
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 9, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 9, 2024
flutter/flutter@fafd67d...5103d75

2024-07-09 andrewrkolos@gmail.com [tool] Remove some usages of deprecated usage package (flutter/flutter#151359)
2024-07-09 43759233+kenzieschmoll@users.noreply.github.com Write the package config location to the test bootstrap. (flutter/flutter#150440)
2024-07-09 dacoharkes@google.com [deps] Roll dart-lang/native packages (flutter/flutter#151403)
2024-07-08 andrewrkolos@gmail.com [tool] make `testUsingContext` provide a `Stdio` (with `hasTerminal` unset) override by default (flutter/flutter#151357)
2024-07-08 120297255+PurplePolyhedron@users.noreply.github.com Make `FittedBox` not throw when child has zero size. (flutter/flutter#150430)
2024-07-08 nate.w5687@gmail.com Update `DataTable` documentation (flutter/flutter#151356)
2024-07-08 nate.w5687@gmail.com `MaterialState` � `WidgetState` in documentation (flutter/flutter#151376)
2024-07-08 41930132+hellohuanlin@users.noreply.github.com [ios]A typical news app benchmark with bottom ad banner (flutter/flutter#150991)
2024-07-08 gspencergoog@users.noreply.github.com Re-enable `SemanticsAction.focus` matchers (flutter/flutter#150990)
2024-07-08 hans.muller@gmail.com Added SliverFloatingHeader.snapMode (flutter/flutter#151289)
2024-07-08 nate.w5687@gmail.com Factor out deprecated names in example code (flutter/flutter#151374)
2024-07-08 cedvandenbosch@gmail.com Add cedric vanden bosch to authors (flutter/flutter#151313)
2024-07-08 engine-flutter-autoroll@skia.org Roll Packages from 97bad7e to 14341d1 (5 revisions) (flutter/flutter#151417)
2024-07-08 srawlins@google.com Update doc-import to primary configured import, _goldens_io.dart (flutter/flutter#151390)
2024-07-08 tessertaha@gmail.com [Reland] - Enable `explicitChildNodes` for the `AlertDialog` content (flutter/flutter#149597)
2024-07-08 32538273+ValentinVignal@users.noreply.github.com Add tests for material_state_border_side.0_test.dart (flutter/flutter#151089)
2024-07-08 engine-flutter-autoroll@skia.org Roll Flutter Engine from ca79a56a66d7 to 69075e7e87d4 (1 revision) (flutter/flutter#151393)
2024-07-08 32538273+ValentinVignal@users.noreply.github.com Add tests for action_listener.0.dart (flutter/flutter#150606)
2024-07-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5ca3b856ee5a to ca79a56a66d7 (1 revision) (flutter/flutter#151387)
2024-07-06 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3600ec613a00 to 5ca3b856ee5a (1 revision) (flutter/flutter#151378)
2024-07-06 engine-flutter-autoroll@skia.org Roll Flutter Engine from d1ebc5fde630 to 3600ec613a00 (1 revision) (flutter/flutter#151377)
2024-07-06 engine-flutter-autoroll@skia.org Roll Flutter Engine from e6b09697df1a to d1ebc5fde630 (1 revision) (flutter/flutter#151362)
2024-07-05 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.3.3 to 4.3.4 (flutter/flutter#151354)
2024-07-05 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4ee09d3b7f3b to e6b09697df1a (2 revisions) (flutter/flutter#151352)
2024-07-05 sokolovskyi.konstantin@gmail.com Add tests for color_filtered.0.dart example. (flutter/flutter#151064)
2024-07-05 christopherfujino@gmail.com de-duplicate code in analyze.dart (flutter/flutter#151279)
2024-07-05 engine-flutter-autoroll@skia.org Roll Packages from 754de19 to 97bad7e (1 revision) (flutter/flutter#151350)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC dit@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants