Skip to content

test(ensemble): cover progress timer dispose and ListView scroll APIs#2242

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-2d05
Draft

test(ensemble): cover progress timer dispose and ListView scroll APIs#2242
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-2d05

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented May 29, 2026

Risky behavior now covered

  • Progress indicator countdown timers (07e1786b): Ensures countdownTimer and mainTimer are cancelled when the widget is removed from the tree, preventing post-dispose setState and leaked periodic timers.
  • ListView scroll position API (4f5052b1 / scroll helpers): Verifies scrollToOffset is a safe no-op without scroll clients, jumps to a pixel offset when not animated, and scrollToTop resets offset to zero.

Test files added/updated

  • modules/ensemble/test/widget/progress_indicator_test.dart (new)
  • modules/ensemble/test/widget/list_view_test.dart (extended)

Why these tests materially reduce regression risk

Progress countdown uses two concurrent timers; the prior bug left mainTimer running after dispose and called setState on an unmounted widget. A widget test that unmounts the indicator and advances time past the countdown catches timer leaks immediately.

scrollToOffset / scrollToTop are invoked from YAML/script and must not throw when the list is not laid out yet, and must move the attached ScrollController when clients exist. These tests lock in the controller guard and scroll behavior without brittle layout snapshots.

Validation

flutter test test/widget/progress_indicator_test.dart
flutter test test/widget/list_view_test.dart --name "scrollToOffset|scrollToTop|no-op"

All new tests pass. (An existing footer-scope ListView test in the same file can fail independently of this change.)

Open in Web View Automation 

Add widget tests for EnsembleProgressIndicator countdown timer cleanup
after dispose (regression guard for 07e1786) and for ListViewController
scrollToOffset/scrollToTop behavior added in scrollToOffset work.

Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant