mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-12-05 09:55:11 +00:00
70 lines
2.1 KiB
Dart
70 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hbb/mobile/pages/file_manager_page.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
Widget buildSubject({
|
|
VoidCallback? onCanceled,
|
|
List<IconButton>? actions,
|
|
}) {
|
|
return MaterialApp(
|
|
home: Scaffold(
|
|
bottomSheet: BottomSheetBody(
|
|
leading: const Icon(Icons.check),
|
|
title: 'Wybrano',
|
|
text: '1 elementów [Lokalny]',
|
|
onCanceled: onCanceled,
|
|
actions: actions,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
testWidgets('keeps action buttons above bottom system navigation bar',
|
|
(tester) async {
|
|
tester.view.physicalSize = const Size(360, 800);
|
|
tester.view.devicePixelRatio = 1.0;
|
|
tester.view.padding = const FakeViewPadding(bottom: 48);
|
|
tester.view.viewPadding = const FakeViewPadding(bottom: 48);
|
|
addTearDown(tester.view.reset);
|
|
|
|
var canceled = false;
|
|
await tester.pumpWidget(buildSubject(
|
|
onCanceled: () => canceled = true,
|
|
actions: [
|
|
IconButton(icon: const Icon(Icons.save_alt), onPressed: () {}),
|
|
IconButton(icon: const Icon(Icons.compare_arrows), onPressed: () {}),
|
|
IconButton(icon: const Icon(Icons.delete_forever), onPressed: () {}),
|
|
],
|
|
));
|
|
|
|
expect(tester.takeException(), isNull);
|
|
expect(tester.getSize(find.byType(BottomSheetBody)).height, 113.0);
|
|
for (final icon in const [
|
|
Icons.save_alt,
|
|
Icons.compare_arrows,
|
|
Icons.delete_forever,
|
|
Icons.cancel_outlined,
|
|
]) {
|
|
expect(tester.getBottomRight(find.byIcon(icon)).dy,
|
|
lessThanOrEqualTo(752.0));
|
|
}
|
|
|
|
await tester.tap(find.byIcon(Icons.cancel_outlined));
|
|
await tester.pump();
|
|
expect(canceled, isTrue);
|
|
});
|
|
|
|
testWidgets('preserves default height when bottom inset is zero',
|
|
(tester) async {
|
|
tester.view.physicalSize = const Size(360, 800);
|
|
tester.view.devicePixelRatio = 1.0;
|
|
addTearDown(tester.view.reset);
|
|
|
|
await tester.pumpWidget(buildSubject());
|
|
|
|
expect(tester.takeException(), isNull);
|
|
expect(tester.getSize(find.byType(BottomSheetBody)).height, 65.0);
|
|
});
|
|
}
|