feat(app): the artifact viewer page stays still; previews fill and zoom or scroll inside their frame; facts behind a Details button
This commit is contained in:
@@ -118,6 +118,8 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||
expect(find.text('# Recorded input'), findsOneWidget);
|
||||
await tester.tap(find.byKey(const Key('artifact-info')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('review · visit 1'), findsOneWidget);
|
||||
expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget);
|
||||
});
|
||||
|
||||
@@ -108,6 +108,17 @@ Future<void> _openMarkdownFromGallery(
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
/// The recorded facts sit behind the viewer's Details button.
|
||||
Future<void> showFacts(WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(const Key('artifact-info')));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> hideFacts(WidgetTester tester) async {
|
||||
await tester.tapAt(const Offset(5, 5));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets('an image is previewed in-app without opening a tab', (
|
||||
tester,
|
||||
@@ -154,7 +165,14 @@ void main() {
|
||||
Uri.parse('http://127.0.0.1:8081/artifacts/1/1/shot.png'),
|
||||
});
|
||||
expect(find.byType(Image), findsOneWidget);
|
||||
// The page itself does not scroll; the image zooms inside its frame.
|
||||
expect(find.byKey(const Key('artifact-image-zoom')), findsOneWidget);
|
||||
expect(
|
||||
find.ancestor(of: find.byType(Image), matching: find.byType(Scrollable)),
|
||||
findsNothing,
|
||||
);
|
||||
expect(find.text('1 of 1 · image/png'), findsOneWidget);
|
||||
await showFacts(tester);
|
||||
expect(find.text('image/png · 1.0\u00a0KiB'), findsOneWidget);
|
||||
expect(opened, isEmpty);
|
||||
expect(find.byType(AlertDialog), findsNothing);
|
||||
@@ -180,6 +198,7 @@ void main() {
|
||||
|
||||
expect(find.byType(SelectableText), findsOneWidget);
|
||||
expect(find.text('build ok\n'), findsOneWidget);
|
||||
await showFacts(tester);
|
||||
expect(find.text('text/plain · 0\u00a0B'), findsOneWidget);
|
||||
});
|
||||
|
||||
@@ -366,7 +385,9 @@ void main() {
|
||||
await tester.tap(find.byKey(artifactNextKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('2 of 3 · image/png'), findsOneWidget);
|
||||
await showFacts(tester);
|
||||
expect(find.text('review · visit 2'), findsOneWidget);
|
||||
await hideFacts(tester);
|
||||
expect(
|
||||
tester.widget<IconButton>(find.byKey(artifactPreviousKey)).onPressed,
|
||||
isNotNull,
|
||||
@@ -475,8 +496,9 @@ void main() {
|
||||
expect(find.text('final n = 1;'), findsOneWidget);
|
||||
expect(find.text('# Report'), findsNothing);
|
||||
expect(find.text('A paragraph with bold and code.'), findsOneWidget);
|
||||
// The recorded facts stay visible above the preview.
|
||||
// The position stays on the top edge; the facts are one tap away.
|
||||
expect(find.text('1 of 1 · text/markdown'), findsOneWidget);
|
||||
await showFacts(tester);
|
||||
expect(find.text('text/markdown · 4.0\u00a0KiB'), findsOneWidget);
|
||||
expect(find.text('review · visit 1'), findsOneWidget);
|
||||
});
|
||||
@@ -496,6 +518,7 @@ void main() {
|
||||
expect(find.text('Report'), findsOneWidget);
|
||||
expect(find.text('dart'), findsOneWidget);
|
||||
expect(find.text('1 of 1 · artifact'), findsOneWidget);
|
||||
await showFacts(tester);
|
||||
expect(find.text('type not recorded · 4.0\u00a0KiB'), findsOneWidget);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user