38 lines
2.0 KiB
Dart
38 lines
2.0 KiB
Dart
import 'dart:io';
|
||
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutter/services.dart';
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
import 'package:jj_mkvmaker/app/app_controller.dart';
|
||
import 'package:jj_mkvmaker/platform/windows/desktop_storage_service.dart';
|
||
import 'package:jj_mkvmaker/platform/windows/process_media_tool.dart';
|
||
import 'package:jj_mkvmaker/services/platform_services.dart';
|
||
import 'package:jj_mkvmaker/ui/settings_page.dart';
|
||
|
||
/// 255: 세로 폰의 환경 설정 - 위의 묶음 바로가기가 한 줄 (여러 줄로 감겨 화면 절반을 차지하지 않게)
|
||
void main() {
|
||
for (final (size, oneRow) in [(const Size(412, 900), true), (const Size(1400, 900), false)]) {
|
||
testWidgets('255: 묶음 바로가기 (${size.width.round()}×${size.height.round()}) - 좁으면 한 줄', (tester) async {
|
||
final tmp = Directory.systemTemp.createTempSync('jj_set255_');
|
||
addTearDown(() => tmp.deleteSync(recursive: true));
|
||
const pp = MethodChannel('plugins.flutter.io/path_provider');
|
||
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(pp, (_) async => tmp.path);
|
||
addTearDown(() => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(pp, null));
|
||
tester.view.physicalSize = size;
|
||
tester.view.devicePixelRatio = 1;
|
||
addTearDown(tester.view.reset);
|
||
final c = AppController(PlatformServices(mediaTool: ProcessMediaTool('x', 'y'), storage: DesktopStorageService()));
|
||
await tester.runAsync(() => tester.pumpWidget(MaterialApp(home: SettingsPage(c: c))));
|
||
await tester.pump();
|
||
final tops = {for (final e in find.byType(ActionChip).evaluate()) tester.getRect(find.byWidget(e.widget)).top.round()};
|
||
expect(tops, isNotEmpty);
|
||
if (oneRow) {
|
||
expect(tops, hasLength(1), reason: '좁으면 한 줄 (옆으로 밀기)');
|
||
}
|
||
expect(tester.takeException(), isNull);
|
||
await tester.pumpWidget(const SizedBox());
|
||
await tester.pump(const Duration(seconds: 1));
|
||
});
|
||
}
|
||
}
|