360 화면: 다운로드 종료 창 제목 두 줄 (G1) · AI 해상도 비교 화면 고르기를 둘째 줄로 (G2)

- G1 (관리자 승인 10/21, 15 찾음): 받는 중에 종료할 때 창 제목이 360 에서 넘쳐 개수와 [✕] 가 잘림 → 제목은 두 줄까지, [✕] 늘 보임
- G2 (관리자 승인 10/21, 15 찾음): 비교 화면 위 막대가 넘쳐 제목이 안 보이고 [저장] 글자가 잘림 →
  폭 600 미만이면 원본 / 올린 것 고르기를 위 막대 아래 둘째 줄로, [저장] 은 글자 그대로. 넓으면 그대로
- 시험: windows_hdr360_shot (ko · ja × 360 · 412). 종료 창의 "받는 중" 상태는 가짜 받기 백엔드로 만듦 (배치만 확인)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
after_1020
RyuJongJin 2026-10-21 20:06:05 +09:00
parent 7247aeb55e
commit a22832d130
3 changed files with 141 additions and 11 deletions

View File

@ -0,0 +1,121 @@
import 'dart:async';
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:image/image.dart' as img;
import 'package:integration_test/integration_test.dart';
import 'package:jj_mkvmaker/app/download_manager.dart';
import 'package:jj_mkvmaker/app/i18n_controller.dart';
import 'package:jj_mkvmaker/app/settings.dart';
import 'package:jj_mkvmaker/core/download_detect.dart';
import 'package:jj_mkvmaker/l10n/tr.dart';
import 'package:jj_mkvmaker/services/downloader.dart';
import 'package:jj_mkvmaker/ui/ai_upscale_ui.dart';
import 'package:jj_mkvmaker/ui/downloads_page.dart';
import 'package:jj_mkvmaker/ui/theme.dart';
import 'package:path/path.dart' as p;
import 'support/temp_dir.dart';
/// 받는 중에서 멈춰 있는 받기 (네트워크 없음)
class _Backend implements DownloadBackend {
@override
DownloadKind get kind => DownloadKind.video;
@override
Future<(String, List<PlaylistEntry>)?> expandPlaylist(String url) async => null;
@override
Future<void> start(DownloadTask t, void Function() changed) async {
t.state = DownloadState.downloading;
changed();
}
@override
Future<void> pause(DownloadTask t) async {}
@override
Future<void> cancel(DownloadTask t) async {}
@override
Future<void> shutdown() async {}
}
/// 관리자 지시 (10/21, F11 다음): "제목 + 단추 + ✕" 모양의 다른 창도 360 에서 - ① 다운로드 종료 확인 창 ② AI 해상도 비교 화면.
/// 넘치지 않고 ✕ (닫기 · 종료) 와 [저장] 이 화면 안. ko · ja × 360 · 412
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
final out = Platform.environment['JJ_SHOT_DIR'] ?? '';
for (final lang in ['ko', 'ja']) {
for (final (w, h) in [(360, 780), (412, 900)]) {
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 tmp = testTempDir('jj_hdr360_');
final shotKey = GlobalKey();
final navKey = GlobalKey<NavigatorState>();
await t.pumpWidget(MaterialApp(
theme: buildTheme(),
debugShowCheckedModeBanner: false,
navigatorKey: navKey,
builder: (context, child) => RepaintBoundary(key: shotKey, child: child),
home: const Scaffold(body: SizedBox.expand()),
));
Future<void> settle([int n = 8]) async {
for (var i = 0; i < n; i++) {
await t.runAsync(() => Future<void>.delayed(const Duration(milliseconds: 50)));
await t.pump();
}
}
Future<void> shot(String name) async {
await settle(3);
if (out.isNotEmpty) {
final b = shotKey.currentContext!.findRenderObject()! as RenderRepaintBoundary;
final im = await t.runAsync(() => b.toImage());
final bytes = await t.runAsync(() => im!.toByteData(format: ui.ImageByteFormat.png));
Directory(out).createSync(recursive: true);
File(p.join(out, 'hdr_${name}_${lang}_$w.png')).writeAsBytesSync(bytes!.buffer.asUint8List());
}
expect(t.takeException(), isNull, reason: '$name 넘침');
}
void inside(Finder f, String what) {
final r = t.getRect(f);
expect(r.left >= -0.5 && r.right <= w + 0.5, isTrue, reason: '$what 화면 안 ($r)');
}
// ① 다운로드 종료 확인 창 (받는 중 2개)
final s = AppSettings()..downloadRoot = tmp.path;
final d = DownloadManager(backends: [_Backend()], settings: () => s, readClipboard: () async => null);
addTearDown(d.dispose);
d.addPage('https://cdn.example.com/a')!.title = 'アップロードされた とても長い 動画のタイトル - 第1話 高画質版';
d.addPage('https://cdn.example.com/b')!.title = 'Test video 2';
await settle();
unawaited(confirmExit(navKey.currentContext!, d));
await settle();
inside(find.byTooltip(tr('종료')), '✕ (종료)');
await shot('1_exit');
navKey.currentState!.popUntil((r) => r.isFirst);
await settle();
// ② AI 해상도 비교 화면 - 긴 그림 이름
final a = p.join(tmp.path, 'a.png');
final b = p.join(tmp.path, 'b.png');
File(a).writeAsBytesSync(img.encodePng(img.Image(width: 40, height: 30)));
File(b).writeAsBytesSync(img.encodePng(img.Image(width: 80, height: 60)));
unawaited(navKey.currentState!.push<bool>(MaterialPageRoute(
builder: (_) => UpscaleCompareView(original: a, upscaled: b, title: '아주 긴 이름의 만화 스캔 - 제1권 012쪽_x2.png'))));
await settle(12);
inside(find.byTooltip(tr('닫기')), '✕ (닫기)');
inside(find.text(tr('저장')), '[저장]');
inside(find.text(tr('올린 것')), '[올린 것]');
expect(t.getRect(find.text('아주 긴 이름의 만화 스캔 - 제1권 012쪽_x2.png')).width > 40, isTrue, reason: '제목이 보임');
await shot('2_compare');
});
}
}
}

View File

@ -617,21 +617,30 @@ class UpscaleCompareViewState extends State<UpscaleCompareView> {
}
Widget _page(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
leading: IconButton(tooltip: tr('닫기'), icon: const Icon(Icons.close), onPressed: _close),
title: Text(widget.title, maxLines: 1, overflow: TextOverflow.ellipsis),
actions: [
SegmentedButton<bool>(
final pick = SegmentedButton<bool>(
segments: [
ButtonSegment(value: false, label: Text(tr('원본'))),
ButtonSegment(value: true, label: Text(tr('올린 것'))),
],
selected: {_up},
onSelectionChanged: (v) => setState(() => _up = v.first),
),
const SizedBox(width: 8),
);
// 관리자 지시 (10/21, 15 찾음 G2): 360 에서 위 막대가 넘쳐 제목이 안 보이고 [저장] 글자가 잘렸다 -
// 좁으면 원본 / 올린 것 고르기를 위 막대 아래 둘째 줄로. 넓으면 그대로
final narrow = MediaQuery.sizeOf(context).width < 600;
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
leading: IconButton(tooltip: tr('닫기'), icon: const Icon(Icons.close), onPressed: _close),
title: Text(widget.title, maxLines: 1, overflow: TextOverflow.ellipsis),
bottom: narrow
? PreferredSize(
preferredSize: const Size.fromHeight(52),
child: Padding(padding: const EdgeInsets.only(bottom: 8), child: Center(child: pick)),
)
: null,
actions: [
if (!narrow) ...[pick, const SizedBox(width: 8)],
FilledButton.icon(
onPressed: () => Navigator.pop(context, true),
icon: const Icon(Icons.save_outlined, size: 18),

View File

@ -509,9 +509,9 @@ class _ExitDialog extends StatelessWidget {
final active = d.tasks.where((t) => t.unfinished).toList();
return AlertDialog(
titlePadding: const EdgeInsets.fromLTRB(24, 16, 8, 0),
// 관리자 지시 (10/21, 15 찾음 G1): 360 에서 제목이 넘쳐 개수와 [✕] 가 잘렸다 - 제목은 두 줄까지 감싸고 [✕] 는 늘 보이게
title: Row(children: [
Text(trf('받는 중인 다운로드 {0}개', [active.length])),
const Spacer(),
Expanded(child: Text(trf('받는 중인 다운로드 {0}개', [active.length]), maxLines: 2, overflow: TextOverflow.ellipsis)),
IconButton(
tooltip: tr('종료'),
icon: const Icon(Icons.close),