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

Simplify public API #290

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Add unit tests

0d7f36c
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Draft

Simplify public API #290

Add unit tests
0d7f36c
Select commit
Loading
Failed to load commit list.
GitHub Actions / Test Report (with Flutter 3.22.3) succeeded Dec 24, 2024 in 0s

88 passed, 0 failed and 0 skipped

Tests passed successfully

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

88 tests were completed in 14s with 88 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
test/foundation/physics_test.dart 33✅ 146ms
test/foundation/sheet_activity_test.dart 11✅ 104ms
test/foundation/sheet_notification_test.dart 3✅ 348ms
test/foundation/sheet_viewport_test.dart 4✅ 492ms
test/modal/modal_sheet_test.dart 10✅ 1s
test/paged/paged_sheet_geometry_test.dart 0ms
test/paged/paged_sheet_test.dart 8✅ 2s
test/scrollable/scrollable_sheet_test.dart 8✅ 1s
test/src/test_ticker_test.dart 11✅ 56ms

✅ 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
  ✅ dragStartDistanceMotionThreshold for different platforms
  ✅ 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
  ✅ findSettledPosition
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
sortPositionsAndFindNearest
  ✅ with two positions
  ✅ with three positions
  ✅ with more than three positions

✅ 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 an idle activity when it reaches destination
  ✅ Should absorb viewport changes
IdleSheetActivity
  ✅ should maintain previous position when keyboard appears
  ✅ should maintain previous position when content size changes, without animation if gap is small
  ✅ should maintain previous position 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
Transition animation status and animation curve consistency test
  ✅ Swipe-to-dismissed
  ✅ Swipe-to-dismiss canceled
Transition animation status and animation curve consistency test with Navigator 2.0
  ✅ Swipe-to-dismissed
  ✅ Swipe-to-dismiss canceled

✅ test/paged/paged_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 interrupt 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

✅ test/src/test_ticker_test.dart

✅ Should call onTick callback when tick is manually advanced
✅ Should reset elapsed time when start is called
✅ Should not call onTick when ticker is stopped
✅ Should not call onTick when ticker is muted
✅ Should throw error if start is called while already active
✅ Should correctly reflect isActive state
✅ Should correctly reflect isTicking state
✅ dispose Should stop ticker and make it inactive
✅ tick Should not advance if ticker is disposed
✅ should call onTick repeatedly with custom duration until ticker is inactive
✅ toString Should include debugLabel if provided