286506310c
Phase 2b.4 of docs/plans/floating-windows.md: both use showAppDetails (a dialog on a wide app, a bottom sheet on a phone). Implemented by pipeline run 305; landed by hand after its UI review found the dialog clipped, which the helper now scrolls.
62 lines
1.8 KiB
Dart
62 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/artifacts/ui/artifact_external_open.dart';
|
|
import 'package:pipelines_app/features/chat/data/directory_listing.dart';
|
|
import 'package:pipelines_app/features/chat/files/files_details.dart';
|
|
|
|
const _entry = DirectoryEntry(
|
|
name: 'report.txt',
|
|
path: '/home/report.txt',
|
|
isDir: false,
|
|
isGitRepo: false,
|
|
hidden: false,
|
|
size: 1024,
|
|
modified: '2026-01-02T03:04:05Z',
|
|
);
|
|
|
|
Widget _app() {
|
|
return MaterialApp(
|
|
home: Scaffold(
|
|
body: Builder(
|
|
builder: (context) => TextButton(
|
|
onPressed: () => showFileDetails(
|
|
context,
|
|
entry: _entry,
|
|
urls: null,
|
|
download: null,
|
|
openExternal: ((_) async => false) as ArtifactExternalOpen,
|
|
),
|
|
child: const Text('Details'),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _size(WidgetTester tester, Size size) {
|
|
tester.view.physicalSize = size;
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.reset);
|
|
}
|
|
|
|
void main() {
|
|
testWidgets('wide file details use a dialog', (tester) async {
|
|
_size(tester, const Size(1280, 800));
|
|
await tester.pumpWidget(_app());
|
|
await tester.tap(find.text('Details'));
|
|
await tester.pumpAndSettle();
|
|
expect(find.byType(Dialog), findsOneWidget);
|
|
expect(find.byType(BottomSheet), findsNothing);
|
|
expect(find.text('report.txt'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('phone file details use a bottom sheet', (tester) async {
|
|
_size(tester, const Size(430, 900));
|
|
await tester.pumpWidget(_app());
|
|
await tester.tap(find.text('Details'));
|
|
await tester.pumpAndSettle();
|
|
expect(find.byType(BottomSheet), findsOneWidget);
|
|
expect(find.byType(Dialog), findsNothing);
|
|
});
|
|
}
|