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

Refine idle activity behavior during keyboard (dis)appearance #243

Merged
merged 5 commits into from
Sep 19, 2024

Add tests

9e6eea0
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

Refine idle activity behavior during keyboard (dis)appearance #243

Add tests
9e6eea0
Select commit
Loading
Failed to load commit list.
GitHub Actions / Test Report (with Flutter 3.22.3) succeeded Sep 18, 2024 in 1s

78 passed, 0 failed and 0 skipped

Tests passed successfully

✅ /home/runner/work/smooth_sheets/smooth_sheets/flutter-test-report.json

78 tests were completed in 13s with 78 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
test/draggable/draggable_sheet_test.dart 4✅ 1s
test/foundation/physics_test.dart 34✅ 168ms
test/foundation/sheet_activity_test.dart 11✅ 100ms
test/foundation/sheet_notification_test.dart 3✅ 399ms
test/foundation/sheet_viewport_test.dart 4✅ 474ms
test/modal/modal_sheet_test.dart 6✅ 1s
test/navigation/navigation_sheet_test.dart 8✅ 2s
test/scrollable/scrollable_sheet_test.dart 8✅ 2s

✅ test/draggable/draggable_sheet_test.dart

✅ Inherited controller should be attached
✅ Opening keyboard does not interrupt sheet animation
SheetKeyboardDismissible
  ✅ should dismiss the keyboard when dragging
  ✅ should dismiss the keyboard when scrolling

✅ test/foundation/physics_test.dart

✅ FixedBouncingBehavior returns same value for same input metrics
✅ DirectionAwareBouncingBehavior respects gesture direction
SheetPhysics subclasses
  ✅ can create dynamic inheritance relationships
Default configuration of SheetPhysics
  ✅ does not allow over/under dragging
  ✅ does not apply any resistance if position is in bounds
  ✅ prevents position from going out of bounds
  ✅ creates no ballistic simulation if position is in bounds
  ✅ creates ballistic simulation which ends at the nearest edge
  ✅ creates no settling simulation if the position is in bounds
  ✅ creates settling simulation which ends at nearest edge
  ✅ findSettledExtent
SnapToNearestEdge
  ✅ snaps to nearest edge if velocity is small enough
  ✅ is aware of fling gesture direction
  ✅ is disabled if position is out of bounds
  ✅ Boundary conditions
SnapToNearest
  ✅ snaps to nearest edge if velocity is small enough
  ✅ is aware of fling gesture direction
  ✅ is disabled if position is out of bounds
  ✅ Boundary condition: a drag ends exactly at the top detent
  ✅ Boundary condition: flings up exactly at the top detent
  ✅ Boundary condition: flings down exactly at the top detent
  ✅ Boundary condition: a drag ends exactly at the middle detent
  ✅ Boundary condition: flings up exactly at the middle detent
  ✅ Boundary condition: flings down exactly at the middle detent
  ✅ Boundary condition: a drag ends exactly at the bottom detent
  ✅ Boundary condition: flings up exactly at the bottom detent
  ✅ Boundary condition: flings down exactly at the bottom detent
BouncingSheetPhysics
  ✅ progressively applies friction if position is out of bounds
  ✅ does not allow to go beyond bounceable bounds
  ✅ applies friction even if position is on boundary
  ✅ can apply a reasonable friction to extremely large offset
sortExtentsAndFindNearest
  ✅ with two extents
  ✅ with three extents
  ✅ with more than three extents

✅ test/foundation/sheet_activity_test.dart

AnimatedSheetActivity
  ✅ should animate to the destination
  ✅ should absorb viewport changes
SettlingSheetActivity
  ✅ Create with velocity
  ✅ Create with duration
  ✅ Velocity should be set when the activity is initialized
  ✅ Progressively updates current position toward destination
  ✅ Should start a ballistic activity when it reaches destination
  ✅ Should absorb viewport changes
IdleSheetActivity
  ✅ should maintain previous extent when keyboard appears
  ✅ should maintain previous extent when content size changes, without animation if gap is small
  ✅ should maintain previous extent when content size changes, with animation if gap is large

✅ test/foundation/sheet_notification_test.dart

✅ Drag gesture should dispatch drag start/update/end notifications in sequence
✅ Sheet animation should dispatch metrics update notifications
✅ Over-darg gesture should dispatch both darg and overflow notifications

✅ test/foundation/sheet_viewport_test.dart

Ignore pointer test:
  ✅ pointer events on a sheet should be ignored if activity says to do so
  ✅ content in a sheet should receive pointer events if activity allows
  ✅ content obscured by a sheet should never receive pointer events
  ✅ content not obscured by a sheet should always receive pointer events

✅ test/modal/modal_sheet_test.dart

Swipe-to-dismiss action test
  ✅ modal should be dismissed if swipe gesture has enough speed
  ✅ modal should not be dismissed if swipe gesture has not enough speed
  ✅ modal should be dismissed if drag distance is enough
  ✅ modal should not be dismissed if drag distance is not enough
PopScope test
  ✅ PopScope.onPopInvoked should be called when tap on barrier
  ✅ PopScope.onPopInvoked should be called when swipe to dismiss

✅ test/navigation/navigation_sheet_test.dart

✅ Attached controller emits correct pixel values when dragging
✅ Attached controller emits correct boundary values
✅ Inherited controller should be attached
✅ Works with DropdownButton without crashing
✅ Opening keyboard does not interrupts sheet animation
✅ Drag gestures should be ignored during a page transition
SheetKeyboardDismissible
  ✅ should dismiss the keyboard when dragging
  ✅ should dismiss the keyboard when scrolling

✅ test/scrollable/scrollable_sheet_test.dart

✅ Inherited controller should be attached
✅ Opening keyboard does not interrupt sheet animation
Press-and-hold gesture should stop momentum scrolling
  ✅ in a plain ListView
  ✅ in a PageView with multiple ListViews
SheetKeyboardDismissible
  ✅ should dismiss the keyboard when dragging
  ✅ should dismiss the keyboard when scrolling
Infinite ballistic scroll activity test
  ✅ top edge
  ✅ bottom edge