Skip to content

πŸ§ͺ [testing improvement] Add test for _lineBoxCache cache eviction - #13

Merged
esenmx merged 3 commits into
mainfrom
test/line-box-cache-eviction-6579964137937089745
Aug 23, 2026
Merged

πŸ§ͺ [testing improvement] Add test for _lineBoxCache cache eviction#13
esenmx merged 3 commits into
mainfrom
test/line-box-cache-eviction-6579964137937089745

Conversation

@esenmx

@esenmx esenmx commented Aug 22, 2026

Copy link
Copy Markdown
Owner

🎯 What:
Added a unit test for _lineBoxCache cache eviction when more than 16 distinct text styles are processed by AsyncButtonSpinner / _ambientTextLineBox.

πŸ“Š Coverage:

  • Exposes debugLineBoxCache annotated with @visibleForTesting.
  • Asserts that pumping 16 distinct font sizes fills _lineBoxCache to its maximum capacity of 16.
  • Asserts that pumping a 17th distinct font size evicts the oldest cached entry, keeping the total cache length bounded at 16.
  • Asserts that accessing an existing cached entry promotes it in the LRU map without increasing the cache size.

✨ Result:
Closes the testing gap for line box cache bounds and eviction in lib/src/material_async_button_theme.dart. All tests pass cleanly and static analysis passes with zero issues.


PR created automatically by Jules for task 6579964137937089745 started by @esenmx

@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 3 commits August 23, 2026 16:52
Adds an edge case widget test in material_async_button_theme_test.dart
to verify that AsyncButtonSpinner's line box cache stays capped at
a maximum capacity of 16 entries and evicts the oldest entry when a 17th
distinct text style is evaluated. Exposes debugLineBoxCache with
@VisibleForTesting for inspection in tests.

Co-authored-by: esenmx <43244505+esenmx@users.noreply.github.com>
Formats material_async_button_theme_test.dart with `dart format` to
resolve CI format check failure and adds unit test for _lineBoxCache
eviction when capacity exceeds 16 entries.

Co-authored-by: esenmx <43244505+esenmx@users.noreply.github.com>
Type the @VisibleForTesting getter as
Map<(TextStyle, TextDirection, TextScaler), double> instead of
Map<Object, double>, removing the covariance trap and letting the test
assert which entry is oldest via the record's fontSize.

Move the test into its own 'AsyncButtonSpinner line box cache' group,
reset the global cache in addTearDown so a failing assertion cannot leak
entries into later tests, replace the tautological containsKey check
with fontSize assertions, and assert promotion as keys.last == secondKey.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@esenmx
esenmx force-pushed the test/line-box-cache-eviction-6579964137937089745 branch from fed0d13 to c3c54b9 Compare August 23, 2026 13:54
@esenmx
esenmx merged commit ed17581 into main Aug 23, 2026
6 checks passed
@esenmx
esenmx deleted the test/line-box-cache-eviction-6579964137937089745 branch August 23, 2026 13:56
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