Improve file image gestures
This commit is contained in:
@@ -115,6 +115,48 @@ void main() {
|
||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||
expect(find.byType(Image), findsWidgets);
|
||||
});
|
||||
testWidgets('image opened from Files owns pinch and pan until reset', (
|
||||
tester,
|
||||
) async {
|
||||
await pump(
|
||||
tester,
|
||||
viewer: FilesViewer(
|
||||
fetch: (_) async => ArtifactFetchResult(
|
||||
status: 200,
|
||||
bytes: base64Decode(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.tap(find.text('picture.png'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final viewport = tester.getRect(
|
||||
find.byKey(const Key('artifact-image-zoom')),
|
||||
);
|
||||
final center = viewport.center;
|
||||
final one = await tester.startGesture(
|
||||
center + const Offset(-24, 0),
|
||||
pointer: 1,
|
||||
);
|
||||
final two = await tester.startGesture(
|
||||
center + const Offset(24, 0),
|
||||
pointer: 2,
|
||||
);
|
||||
await one.moveTo(center + const Offset(-96, 0));
|
||||
await two.moveTo(center + const Offset(96, 0));
|
||||
await tester.pump();
|
||||
await one.up();
|
||||
await two.up();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('artifact-image-reset-zoom')), findsOneWidget);
|
||||
await tester.tap(find.byKey(const Key('artifact-image-reset-zoom')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('artifact-image-reset-zoom')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('unknown file has metadata and a working download', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user