Skip to content

Fix ImageInfo.isCloneOf tests by moving async work to setUp#185254

Merged
cbracken merged 1 commit into
flutter:masterfrom
Istiak-Ahmed78:fix-iscloneof
Apr 23, 2026
Merged

Fix ImageInfo.isCloneOf tests by moving async work to setUp#185254
cbracken merged 1 commit into
flutter:masterfrom
Istiak-Ahmed78:fix-iscloneof

Conversation

@Istiak-Ahmed78

Copy link
Copy Markdown
Contributor

This PR fixes the non-hermetic tests in ImageInfo.isCloneOf by separating real async operations from the FakeAsync zone.

Problem

The original tests were calling await createTestImage() directly inside testWidgets(), which runs in a FakeAsync zone. This caused:

  • Non-deterministic failures dependent on random seed
  • Timing-dependent issues
  • Non-hermetic tests

Solution

Move the real async work (createTestImage()) to setUp() (outside FakeAsync) and use pre-created images in the test cases.

Changes

  • Added setUp() to create test images before tests run
  • Replaced await createTestImage() with image20x10.clone() in test cases
  • Ensures tests are hermetic and deterministic

Related Issues

Reland of #184643 (which was reverted due to the FakeAsync issue)

Fixes the issue identified in the revert commit: 8e8a194

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or I have commented below to indicate which documented exception this PR falls under[^1].
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under[^1].
  • All existing and new tests are passing.

@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Apr 19, 2026
@Istiak-Ahmed78
Istiak-Ahmed78 marked this pull request as ready for review April 19, 2026 07:59

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request corrects a logic error in ImageInfo.isCloneOf where the scale was incorrectly compared to itself rather than the other object's scale. New tests were added to verify this behavior. Review feedback highlights that ImageInfo lacks a dispose method, necessitating the disposal of the underlying image property in tests to prevent memory leaks. Furthermore, the use of ui.Image is suggested to distinguish the raw image object from the Flutter Image widget.

Comment thread packages/flutter/test/painting/image_stream_test.dart
Comment thread packages/flutter/test/painting/image_stream_test.dart
Comment thread packages/flutter/test/painting/image_stream_test.dart
Comment thread packages/flutter/test/painting/image_stream_test.dart
Comment thread packages/flutter/test/painting/image_stream_test.dart
Comment thread packages/flutter/test/painting/image_stream_test.dart
@AbdeMohlbi AbdeMohlbi added the CICD Run CI/CD label Apr 19, 2026
@cbracken
cbracken requested a review from justinmc April 20, 2026 21:37

@cbracken cbracken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

Thanks for resubmitting with the fix!

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 22, 2026
@cbracken
cbracken added this pull request to the merge queue Apr 22, 2026
Merged via the queue into flutter:master with commit 7a00ba7 Apr 23, 2026
87 of 88 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 23, 2026
@Istiak-Ahmed78
Istiak-Ahmed78 deleted the fix-iscloneof branch April 23, 2026 16:29
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Apr 24, 2026
Roll Flutter from 5e4f16931847 to aeb96234de86 (42 revisions)

flutter/flutter@5e4f169...aeb9623

2026-04-24 [email protected] Fix leak on error case (flutter/flutter#185516)
2026-04-24 [email protected] Roll Skia from 04c6c369cfd0 to 1c9b0b9141e9 (2 revisions) (flutter/flutter#185529)
2026-04-24 [email protected] Roll Dart SDK from f386b11262f6 to c26627715892 (1 revision) (flutter/flutter#185526)
2026-04-24 [email protected] Roll Skia from 290a056fcd0e to 04c6c369cfd0 (2 revisions) (flutter/flutter#185525)
2026-04-24 [email protected] [ios] Extract SplashScreenManager from FlutterViewController (flutter/flutter#185405)
2026-04-24 [email protected] Roll Fuchsia Linux SDK from j3UCWZhWx7zSl9Asy... to 9fPnyEo9PaNdXtasl... (flutter/flutter#185523)
2026-04-24 [email protected] Roll Skia from 4c8bedd3c932 to 290a056fcd0e (1 revision) (flutter/flutter#185518)
2026-04-24 [email protected] Roll Dart SDK from 70665fc3fd2e to f386b11262f6 (2 revisions) (flutter/flutter#185512)
2026-04-24 [email protected] Handle hairline strokes in UberSDF (flutter/flutter#184895)
2026-04-24 [email protected] Roll Skia from ea20c73ac72c to 4c8bedd3c932 (3 revisions) (flutter/flutter#185509)
2026-04-24 [email protected] Use relative path for reloadedSourcesUri and reloaded modules (flutter/flutter#184598)
2026-04-24 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Run all flutter/flutter macOS tests using Xcode 26 and iOS 26 simulator (#185431)" (flutter/flutter#185513)
2026-04-24 [email protected] Roll Skia from e8d00d634c22 to ea20c73ac72c (8 revisions) (flutter/flutter#185500)
2026-04-23 [email protected] Run all flutter/flutter macOS tests using Xcode 26 and iOS 26 simulator (flutter/flutter#185431)
2026-04-23 [email protected] update team-text-input pr triage link to filter out "waiting for response" label (flutter/flutter#185499)
2026-04-23 [email protected] Check for overflow when computing the pixel buffer size for an animated PNG frame (flutter/flutter#185442)
2026-04-23 [email protected] Impeller: Recreate Vulkan transients on surface size change (flutter/flutter#185122)
2026-04-23 [email protected] Updating the windowing API for sized to content regular and dialog windows + removing the decorated flag (flutter/flutter#184977)
2026-04-23 [email protected] Roll Dart SDK from 634991935e9a to 70665fc3fd2e (2 revisions) (flutter/flutter#185488)
2026-04-23 [email protected] Updating ios triage link (flutter/flutter#185437)
2026-04-23 [email protected] Revert "Preprovision Android NDK for flavored builds and reuse matchi… (flutter/flutter#185439)
2026-04-23 [email protected] fix(web): Fix LateInitializationError in CkSurface and SkwasmSurface (flutter/flutter#185116)
2026-04-23 [email protected] [web] Implement stepped image downscaling for CanvasKit and Skwasm (flutter/flutter#184741)
2026-04-23 [email protected] Made wide_gamut_macos only run on arm64 machines (flutter/flutter#185486)
2026-04-23 [email protected] [ios] Update documentation for FlutterAppDelegate.pluginRegistrant (flutter/flutter#185201)
2026-04-23 [email protected] Roll Dart SDK from bdf48933f3cf to 634991935e9a (1 revision) (flutter/flutter#185462)
2026-04-23 [email protected] Roll Skia from 5fe6162546b1 to e8d00d634c22 (3 revisions) (flutter/flutter#185459)
2026-04-23 [email protected] Roll Skia from 0049c5d91b08 to 5fe6162546b1 (1 revision) (flutter/flutter#185455)
2026-04-23 [email protected] Roll Dart SDK from 9648f446f131 to bdf48933f3cf (19 revisions) (flutter/flutter#185451)
2026-04-23 [email protected] Roll Skia from 11640d1cbc5c to 0049c5d91b08 (11 revisions) (flutter/flutter#185453)
2026-04-23 [email protected] Add disposal guidance to CurvedAnimation and CurveTween docs (flutter/flutter#184569)
2026-04-23 [email protected] Add `clipBehavior` parameter to `AnimatedCrossFade` (flutter/flutter#184545)
2026-04-23 [email protected] [fuchsia] Ask for only VMEX, not ambient-replace-as-executable. (flutter/flutter#185099)
2026-04-23 [email protected] Unify SemanticUpdateBuilder API for web and non-web (flutter/flutter#185433)
2026-04-22 [email protected] Fix ImageInfo.isCloneOf tests by moving async work to setUp (flutter/flutter#185254)
2026-04-22 [email protected] Roll Fuchsia Linux SDK from UdpQnaP5eSaDZd3-i... to j3UCWZhWx7zSl9Asy... (flutter/flutter#185438)
2026-04-22 [email protected] Adds script to run malioc locally (flutter/flutter#185371)
2026-04-22 [email protected] Add await mechanism to setClipboard in android_semantics_integration test (flutter/flutter#185428)
2026-04-22 [email protected] Add ability to pass flags to `et run` (flutter/flutter#185109)
2026-04-22 [email protected] Add more guidelines for code review bot (flutter/flutter#185367)
2026-04-22 [email protected] Roll pub packages (flutter/flutter#185274)
2026-04-22 [email protected] Fix incorrect scale parameter reference in Image constructor docs (flutter/flutter#185403)

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
...
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11576)

Roll Flutter from 5e4f16931847 to aeb96234de86 (42 revisions)

flutter/flutter@5e4f169...aeb9623

2026-04-24 [email protected] Fix leak on error case (flutter/flutter#185516)
2026-04-24 [email protected] Roll Skia from 04c6c369cfd0 to 1c9b0b9141e9 (2 revisions) (flutter/flutter#185529)
2026-04-24 [email protected] Roll Dart SDK from f386b11262f6 to c26627715892 (1 revision) (flutter/flutter#185526)
2026-04-24 [email protected] Roll Skia from 290a056fcd0e to 04c6c369cfd0 (2 revisions) (flutter/flutter#185525)
2026-04-24 [email protected] [ios] Extract SplashScreenManager from FlutterViewController (flutter/flutter#185405)
2026-04-24 [email protected] Roll Fuchsia Linux SDK from j3UCWZhWx7zSl9Asy... to 9fPnyEo9PaNdXtasl... (flutter/flutter#185523)
2026-04-24 [email protected] Roll Skia from 4c8bedd3c932 to 290a056fcd0e (1 revision) (flutter/flutter#185518)
2026-04-24 [email protected] Roll Dart SDK from 70665fc3fd2e to f386b11262f6 (2 revisions) (flutter/flutter#185512)
2026-04-24 [email protected] Handle hairline strokes in UberSDF (flutter/flutter#184895)
2026-04-24 [email protected] Roll Skia from ea20c73ac72c to 4c8bedd3c932 (3 revisions) (flutter/flutter#185509)
2026-04-24 [email protected] Use relative path for reloadedSourcesUri and reloaded modules (flutter/flutter#184598)
2026-04-24 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Run all flutter/flutter macOS tests using Xcode 26 and iOS 26 simulator (#185431)" (flutter/flutter#185513)
2026-04-24 [email protected] Roll Skia from e8d00d634c22 to ea20c73ac72c (8 revisions) (flutter/flutter#185500)
2026-04-23 [email protected] Run all flutter/flutter macOS tests using Xcode 26 and iOS 26 simulator (flutter/flutter#185431)
2026-04-23 [email protected] update team-text-input pr triage link to filter out "waiting for response" label (flutter/flutter#185499)
2026-04-23 [email protected] Check for overflow when computing the pixel buffer size for an animated PNG frame (flutter/flutter#185442)
2026-04-23 [email protected] Impeller: Recreate Vulkan transients on surface size change (flutter/flutter#185122)
2026-04-23 [email protected] Updating the windowing API for sized to content regular and dialog windows + removing the decorated flag (flutter/flutter#184977)
2026-04-23 [email protected] Roll Dart SDK from 634991935e9a to 70665fc3fd2e (2 revisions) (flutter/flutter#185488)
2026-04-23 [email protected] Updating ios triage link (flutter/flutter#185437)
2026-04-23 [email protected] Revert "Preprovision Android NDK for flavored builds and reuse matchi… (flutter/flutter#185439)
2026-04-23 [email protected] fix(web): Fix LateInitializationError in CkSurface and SkwasmSurface (flutter/flutter#185116)
2026-04-23 [email protected] [web] Implement stepped image downscaling for CanvasKit and Skwasm (flutter/flutter#184741)
2026-04-23 [email protected] Made wide_gamut_macos only run on arm64 machines (flutter/flutter#185486)
2026-04-23 [email protected] [ios] Update documentation for FlutterAppDelegate.pluginRegistrant (flutter/flutter#185201)
2026-04-23 [email protected] Roll Dart SDK from bdf48933f3cf to 634991935e9a (1 revision) (flutter/flutter#185462)
2026-04-23 [email protected] Roll Skia from 5fe6162546b1 to e8d00d634c22 (3 revisions) (flutter/flutter#185459)
2026-04-23 [email protected] Roll Skia from 0049c5d91b08 to 5fe6162546b1 (1 revision) (flutter/flutter#185455)
2026-04-23 [email protected] Roll Dart SDK from 9648f446f131 to bdf48933f3cf (19 revisions) (flutter/flutter#185451)
2026-04-23 [email protected] Roll Skia from 11640d1cbc5c to 0049c5d91b08 (11 revisions) (flutter/flutter#185453)
2026-04-23 [email protected] Add disposal guidance to CurvedAnimation and CurveTween docs (flutter/flutter#184569)
2026-04-23 [email protected] Add `clipBehavior` parameter to `AnimatedCrossFade` (flutter/flutter#184545)
2026-04-23 [email protected] [fuchsia] Ask for only VMEX, not ambient-replace-as-executable. (flutter/flutter#185099)
2026-04-23 [email protected] Unify SemanticUpdateBuilder API for web and non-web (flutter/flutter#185433)
2026-04-22 [email protected] Fix ImageInfo.isCloneOf tests by moving async work to setUp (flutter/flutter#185254)
2026-04-22 [email protected] Roll Fuchsia Linux SDK from UdpQnaP5eSaDZd3-i... to j3UCWZhWx7zSl9Asy... (flutter/flutter#185438)
2026-04-22 [email protected] Adds script to run malioc locally (flutter/flutter#185371)
2026-04-22 [email protected] Add await mechanism to setClipboard in android_semantics_integration test (flutter/flutter#185428)
2026-04-22 [email protected] Add ability to pass flags to `et run` (flutter/flutter#185109)
2026-04-22 [email protected] Add more guidelines for code review bot (flutter/flutter#185367)
2026-04-22 [email protected] Roll pub packages (flutter/flutter#185274)
2026-04-22 [email protected] Fix incorrect scale parameter reference in Image constructor docs (flutter/flutter#185403)

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
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants