57 lines
3.0 KiB
Dart
57 lines
3.0 KiB
Dart
import 'dart:io';
|
|
import 'dart:ui' as ui;
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/rendering.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:integration_test/integration_test.dart';
|
|
import 'package:jj_mkvmaker/app/app_controller.dart';
|
|
import 'package:jj_mkvmaker/app/i18n_controller.dart';
|
|
import 'package:jj_mkvmaker/l10n/tr.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';
|
|
import 'package:jj_mkvmaker/ui/theme.dart';
|
|
import 'package:path/path.dart' as p;
|
|
|
|
/// 관리자 판단 (10/20): 환경 설정 > 파일 탐색기의 "원격 서버 응답 기다리기" (30 · 60 · 120 · 300초) 를
|
|
/// 412 · 960, ko · en · ja 로 찍는다 (설정은 바꾸지 않음 - 시험 안의 설정만).
|
|
/// 실행: flutter test integration_test\windows_remote_idle_shot_test.dart -d windows (JJ_SHOT_DIR 에 PNG)
|
|
void main() {
|
|
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
final out = Platform.environment['JJ_SHOT_DIR'] ?? p.join(Directory.systemTemp.path, 'jj_shots_remote_idle');
|
|
for (final lang in ['ko', 'en', 'ja']) {
|
|
for (final (w, h) in [(412, 900), (960, 600)]) {
|
|
testWidgets('원격 서버 응답 기다리기 $lang ${w}x$h', (t) async {
|
|
t.view.physicalSize = Size(w.toDouble(), h.toDouble());
|
|
t.view.devicePixelRatio = 1;
|
|
addTearDown(t.view.reset);
|
|
await t.runAsync(() => i18n.apply(lang, save: false));
|
|
addTearDown(() => i18n.apply('ko', save: false));
|
|
final c = AppController(PlatformServices(mediaTool: ProcessMediaTool('x', 'y'), storage: DesktopStorageService()));
|
|
final key = GlobalKey();
|
|
await t.pumpWidget(MaterialApp(
|
|
theme: buildTheme(),
|
|
debugShowCheckedModeBanner: false,
|
|
home: RepaintBoundary(key: key, child: SettingsPage(c: c)),
|
|
));
|
|
await t.pump(const Duration(milliseconds: 300));
|
|
final tile = find.text(tr('원격 서버 응답 기다리기'));
|
|
await t.scrollUntilVisible(tile, 300,
|
|
scrollable: find.byWidgetPredicate((x) => x is Scrollable && x.axisDirection == AxisDirection.down).first, maxScrolls: 400);
|
|
await t.pump(const Duration(milliseconds: 300));
|
|
await t.ensureVisible(tile);
|
|
await t.pump(const Duration(milliseconds: 300));
|
|
expect(t.takeException(), isNull, reason: '넘침');
|
|
expect(find.text(trf('{0}초 (기본)', [60])), findsOneWidget);
|
|
final b = key.currentContext!.findRenderObject()! as RenderRepaintBoundary;
|
|
final img = await t.runAsync(() => b.toImage());
|
|
final bytes = await t.runAsync(() => img!.toByteData(format: ui.ImageByteFormat.png));
|
|
Directory(out).createSync(recursive: true);
|
|
File(p.join(out, 'remote_idle_${lang}_$w.png')).writeAsBytesSync(bytes!.buffer.asUint8List());
|
|
});
|
|
}
|
|
}
|
|
}
|