-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,538 additions
and
977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
test/tilt_widget/light_shadow_mode_base_widget/tilt_gestures_drag_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:flutter_tilt/flutter_tilt.dart'; | ||
|
||
void main() { | ||
group('LightShadowMode.base :: tilt gestures drag ::', () { | ||
testWidgets('scroll', (WidgetTester tester) async { | ||
final Finder childFinder = find.text('Tilt'); | ||
final Finder scrollFinder = find.byKey(const Key('scroll')); | ||
final ScrollController scrollController = ScrollController(); | ||
|
||
debugDefaultTargetPlatformOverride = TargetPlatform.windows; | ||
|
||
/// 回调赋值 | ||
await tester.pumpWidget( | ||
MaterialApp( | ||
home: Scaffold( | ||
body: ListView( | ||
controller: scrollController, | ||
children: const <Widget>[ | ||
Tilt( | ||
key: Key('tilt_widget'), | ||
child: SizedBox(width: 100, height: 100, child: Text('Tilt')), | ||
), | ||
SizedBox(key: Key('scroll'), height: 100, width: 100), | ||
SizedBox(height: 1000), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
debugDefaultTargetPlatformOverride = null; | ||
|
||
/// onVerticalDragUpdate | ||
await tester.timedDrag( | ||
childFinder, | ||
const Offset(0.0, -100.0), | ||
const Duration(milliseconds: 1000), | ||
); | ||
await tester.pumpAndSettle(); | ||
expect(scrollController.offset, 0.0); | ||
expect(childFinder, findsOneWidget); | ||
|
||
/// onHorizontalDragUpdate | ||
await tester.timedDrag( | ||
childFinder, | ||
const Offset(-100.0, 0.0), | ||
const Duration(milliseconds: 1000), | ||
); | ||
await tester.pumpAndSettle(); | ||
expect(scrollController.offset, 0.0); | ||
expect(childFinder, findsOneWidget); | ||
|
||
/// scroll | ||
await tester.timedDrag( | ||
scrollFinder, | ||
const Offset(0.0, -100.0), | ||
const Duration(milliseconds: 1000), | ||
warnIfMissed: false, | ||
); | ||
await tester.pumpAndSettle(); | ||
expect(scrollController.offset, 100.0); | ||
expect(childFinder, findsNothing); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.