F6 MKV 자막 줄: 좁아 넘칠 때만 두 줄 (위 = 내장 · 트랙 이름, 아래 = 언어 · 문자셋 고르기 · 단추) · F5 · 206 캡처 시험 (관리자 승인 10/21, 15 찾음)
- 원인: 자막 줄은 한 줄 Row 라 좁은 폭 · 큰 글자 · 일본어에서 오른쪽으로 넘쳐 (1b31609: ja 412 글자 1.0 에서 65px, 외부 자막 + 1.6 에서 219px)
끝의 편집 · 지우기 단추가 잘려 누를 수 없었다
- 고침: 한 줄에 드는 폭 (내장 표 · 이름 최소 60 · 언어 고르기 · 문자셋 · 단추) 을 지금 글꼴 · 글자 배율로 잰다 (고르기는 가장 긴 항목 글의 폭 -
DropdownButton 이 그 폭을 씀). 모자랄 때만 두 줄, 아래 줄은 Wrap. 언어 이름은 "…" 로 줄이지 않음 (무엇을 골랐는지 보이게, 3a 결정).
넓을 때는 예전 한 줄 그대로. 오디오 트랙은 줄이 없고 칩 (음성 n개) 뿐이라 해당 없음
- windows_mkvdetail_shot_test: 412 · 960×600 · 1280×720 × 글자 1.0 · 1.6 × ko · ja (내장 + 외부 자막). 넘침 없음 · 처음 자리에서 칩과
[이동] 단추가 겹치지 않음 (206) · 끝까지 내리면 출력 줄이 단추 위 (F5 - 이미 있던 목록 끝 여백으로) 를 자리로 잰다.
1b31609 에서는 6개 실패 (넘침), 이 고침으로 12개 모두 통과. HomePage 를 쓰는 단위 11파일 111개 통과
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rc2
parent
cb9e4433d3
commit
ebaa054922
|
|
@ -0,0 +1,140 @@
|
|||
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/core/models.dart';
|
||||
import 'package:jj_mkvmaker/core/output_paths.dart';
|
||||
import 'package:jj_mkvmaker/l10n/tr.dart';
|
||||
import 'package:jj_mkvmaker/platform/windows/desktop_storage_service.dart';
|
||||
import 'package:jj_mkvmaker/services/media_tool.dart';
|
||||
import 'package:jj_mkvmaker/services/platform_services.dart';
|
||||
import 'package:jj_mkvmaker/ui/home_page.dart';
|
||||
import 'package:jj_mkvmaker/ui/theme.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
import 'support/temp_dir.dart';
|
||||
|
||||
/// 동영상 하나 (음성 2 · 자막 1) 로 보이는 가짜 FFmpeg (실제로 만들지 않음)
|
||||
class _Tool implements MediaTool {
|
||||
@override
|
||||
Future<String?> version() async => 'ffmpeg test';
|
||||
@override
|
||||
Future<Set<String>> encoders() async => {'libx264'};
|
||||
@override
|
||||
Future<MediaInfo> probe(String path) async => MediaInfo(duration: const Duration(minutes: 24), streams: [
|
||||
const StreamInfo(index: 0, type: 'video', codec: 'h264', width: 1920, height: 1080),
|
||||
const StreamInfo(index: 1, type: 'audio', codec: 'aac', language: 'jpn'),
|
||||
const StreamInfo(index: 2, type: 'audio', codec: 'aac', language: 'kor'),
|
||||
const StreamInfo(index: 3, type: 'subtitle', codec: 'subrip', language: 'kor'),
|
||||
]);
|
||||
@override
|
||||
Future<void> runFfmpeg(List<String> args, {Duration? duration, ProgressCallback? onProgress, Object? tag}) async {}
|
||||
@override
|
||||
void cancel() {}
|
||||
@override
|
||||
void cancelTagged(Object tag) {}
|
||||
}
|
||||
|
||||
/// F5 · 206 (관리자 지시 10/21): MKV 자세히 칸 - 오른쪽 아래 떠 있는 [이동] 단추가 마지막 줄 ("출력: …") 이나 칩을 가리지 않는다.
|
||||
/// 넓은 화면은 끝까지 내리면 마지막 줄이 단추 위로 (목록 끝 여백), 좁은 화면 (412) 은 단추가 칩 줄 아래에 놓인다.
|
||||
/// 412 · 960×600 · 1280×720 × 글자 1.0 · 1.6 × ko · ja. 단추와 출력 줄 · 칩이 겹치는지 자리로 잰다
|
||||
void main() {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
final out = Platform.environment['JJ_SHOT_DIR'] ?? '';
|
||||
|
||||
for (final lang in ['ko', 'ja']) {
|
||||
for (final (w, h, scale) in [(412, 900, 1.0), (412, 900, 1.6), (960, 600, 1.0), (960, 600, 1.6), (1280, 720, 1.0), (1280, 720, 1.6)]) {
|
||||
testWidgets('MKV 자세히 칸 이동 단추 $lang ${w}x$h 글자 $scale', (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_mkvdetail_');
|
||||
appTempInto(tmp);
|
||||
final file = (File(p.join(tmp.path, '[시험] 아주 긴 이름의 동영상 - 1화 고화질.mp4'))..writeAsBytesSync([0])).path;
|
||||
// 같은 폴더의 외부 자막 (문자셋 고르기까지 든 줄 - F6)
|
||||
File(p.join(tmp.path, '[시험] 아주 긴 이름의 동영상 - 1화 고화질.ko.srt')).writeAsStringSync('1\n00:00:01,000 --> 00:00:02,000\n안녕\n');
|
||||
final c = AppController(PlatformServices(mediaTool: _Tool(), storage: DesktopStorageService()));
|
||||
await t.runAsync(() async {
|
||||
await c.init();
|
||||
await c.addVideos([file]);
|
||||
});
|
||||
final shotKey = GlobalKey();
|
||||
await t.pumpWidget(RepaintBoundary(
|
||||
key: shotKey,
|
||||
child: MaterialApp(
|
||||
theme: buildTheme(),
|
||||
debugShowCheckedModeBanner: false,
|
||||
builder: (ctx, child) => MediaQuery(
|
||||
data: MediaQuery.of(ctx).copyWith(textScaler: TextScaler.linear(scale)), child: child!),
|
||||
home: HomePage(c: c),
|
||||
),
|
||||
));
|
||||
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(2);
|
||||
if (out.isEmpty) return;
|
||||
final r = shotKey.currentContext!.findRenderObject()! as RenderRepaintBoundary;
|
||||
final img = await t.runAsync(() => r.toImage());
|
||||
final bytes = await t.runAsync(() => img!.toByteData(format: ui.ImageByteFormat.png));
|
||||
Directory(out).createSync(recursive: true);
|
||||
File(p.join(out, 'mkvdetail_${name}_${lang}_${w}x${h}_s$scale.png')).writeAsBytesSync(bytes!.buffer.asUint8List());
|
||||
}
|
||||
|
||||
await settle();
|
||||
// 좁은 화면은 목록 · 자세히가 위아래 - 동영상 줄을 눌러 자세히를 연다 (넓은 화면은 처음부터 보임)
|
||||
final outputLine = find.text(trf('출력: {0}', [outputMkvPath(file)]));
|
||||
if (outputLine.evaluate().isEmpty && find.text(tr('자막')).evaluate().isEmpty) {
|
||||
await t.tap(find.textContaining('아주 긴 이름의 동영상').first);
|
||||
await settle();
|
||||
}
|
||||
expect(t.takeException(), isNull, reason: '넘침 (처음 자리)');
|
||||
final fab = find.byType(FloatingActionButton);
|
||||
// 206: 처음 자리에서 칩 (음성 n개 등) 이 [이동] 단추에 가리지 않음 (좁은 화면은 단추가 칩 줄 아래에 놓임)
|
||||
if (fab.evaluate().isNotEmpty) {
|
||||
final b = t.getRect(fab.first);
|
||||
for (final text in [trf('음성 {0}개', [2]), trf('영상 {0}', ['h264']), '1920×1080']) {
|
||||
if (find.text(text).evaluate().isEmpty) continue;
|
||||
final r = t.getRect(find.text(text));
|
||||
expect(r.overlaps(b), isFalse, reason: '칩 "$text" 이 단추에 가리지 않음 ($r · 단추 $b)');
|
||||
}
|
||||
}
|
||||
// 글자가 크면 출력 줄이 아래에 있어 아직 만들어지지 않았을 수 있다 - 자세히 칸을 (칩 자리에서) 끌어 내려 찾는다
|
||||
if (outputLine.evaluate().isEmpty) {
|
||||
final down = find.byWidgetPredicate((x) => x is Scrollable && x.axisDirection == AxisDirection.down);
|
||||
final pane = t.state<ScrollableState>(find.ancestor(of: find.text('1920×1080'), matching: down).first);
|
||||
for (var i = 0; i < 10 && outputLine.evaluate().isEmpty; i++) {
|
||||
pane.position.jumpTo(pane.position.maxScrollExtent);
|
||||
await settle(3);
|
||||
}
|
||||
}
|
||||
expect(outputLine, findsOneWidget, reason: '자세히 칸의 출력 줄');
|
||||
await shot('1_top');
|
||||
expect(t.takeException(), isNull, reason: '넘침 (출력 줄까지)');
|
||||
// F5: 자세히 칸을 끝까지 내리면 출력 줄이 단추 위로 (목록 끝 여백)
|
||||
final scroll = t.state<ScrollableState>(find.ancestor(of: outputLine, matching: find.byType(Scrollable)).first);
|
||||
scroll.position.jumpTo(scroll.position.maxScrollExtent);
|
||||
await settle();
|
||||
await shot('2_end');
|
||||
expect(t.takeException(), isNull, reason: '넘침 (끝)');
|
||||
if (fab.evaluate().isNotEmpty && outputLine.evaluate().isNotEmpty) {
|
||||
final b = t.getRect(fab.first), line = t.getRect(outputLine);
|
||||
expect(line.overlaps(b), isFalse, reason: '끝까지 내리면 출력 줄이 단추에 가리지 않음 (줄 $line · 단추 $b)');
|
||||
}
|
||||
expect(c.videos.single.status, isNot(JobStatus.running));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1288,10 +1288,85 @@ class _SubtitleRow extends StatelessWidget {
|
|||
const _SubtitleRow(
|
||||
{required this.c, required this.v, required this.s, required this.locked});
|
||||
|
||||
/// 관리자 지시 (10/21, 15 찾음 F6): 한 줄에 들어가는 폭 - 내장 표 · 이름 (최소) · 언어 고르기 · 문자셋 · 단추.
|
||||
/// 고르기는 가장 긴 항목 글의 폭을 쓰므로 (DropdownButton) 그 글을 지금 글꼴 · 글자 배율로 잰다
|
||||
static double _oneLineWidth(BuildContext context, {required bool embedded, required int buttons}) {
|
||||
final scaler = MediaQuery.textScalerOf(context);
|
||||
final base = DefaultTextStyle.of(context).style;
|
||||
double textW(String t, double size) =>
|
||||
(TextPainter(text: TextSpan(text: t, style: base.copyWith(fontSize: size)), textDirection: TextDirection.ltr, textScaler: scaler, maxLines: 1)
|
||||
..layout())
|
||||
.width;
|
||||
double widest(Iterable<String> xs, double size) => xs.fold(0.0, (m, t) => math.max(m, textW(t, size)));
|
||||
final lang = widest([tr('언어: 미지정'), for (final l in languages) '${l.name} (${l.code})'], 12) + 24;
|
||||
final charset = embedded ? 0.0 : widest(supportedCharsets.values, 12) + 24 + 8;
|
||||
final badge = textW(embedded ? tr('내장') : tr('외부'), 11) + 12;
|
||||
const nameMin = 60.0;
|
||||
return badge + 10 + nameMin + 8 + lang + charset + 4 + buttons * 48;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final embedded = s.kind == SubtitleKind.embedded;
|
||||
final off = !s.enabled;
|
||||
final badge = Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: (embedded ? JjColors.textDim : JjColors.accent)
|
||||
.withValues(alpha: 0.18),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(embedded ? tr('내장') : tr('외부'),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: embedded ? JjColors.textDim : JjColors.accent)),
|
||||
);
|
||||
final name = Text(
|
||||
s.displayName,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: off ? JjColors.textDim : JjColors.text,
|
||||
decoration: off ? TextDecoration.lineThrough : null,
|
||||
),
|
||||
);
|
||||
final pickers = <Widget>[
|
||||
_LanguageDropdown(
|
||||
value: s.language,
|
||||
onChanged: locked || off ? null : (l) => c.setLanguage(s, l),
|
||||
),
|
||||
if (!embedded)
|
||||
_CharsetDropdown(
|
||||
value: s.charset ?? 'UTF-8',
|
||||
onChanged: locked ? null : (cs) => c.setCharset(s, cs),
|
||||
),
|
||||
];
|
||||
final buttons = <Widget>[
|
||||
IconButton(
|
||||
tooltip: c.canEdit(s) ? tr('내용 편집 · 문자셋 변환') : tr('이미지 자막은 편집할 수 없습니다'),
|
||||
iconSize: 18,
|
||||
onPressed: locked || off || !c.canEdit(s)
|
||||
? null
|
||||
: () => openSubtitleEditor(context, c, v, s),
|
||||
icon: const Icon(Icons.edit_note, color: JjColors.accent),
|
||||
),
|
||||
if (c.services.createTranslator != null)
|
||||
IconButton(
|
||||
tooltip: c.canEdit(s) ? trf('다른 언어로 번역 (AI · 이 {0}에서)', [Platform.isAndroid ? tr('기기') : 'PC']) : tr('이미지 자막은 번역할 수 없습니다'),
|
||||
iconSize: 18,
|
||||
onPressed: locked || off || !c.canEdit(s) ? null : () => showTranslateDialog(context, c, v, s),
|
||||
icon: const Icon(Icons.translate, color: JjColors.accent),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: embedded ? (off ? tr('되살리기') : tr('삭제 (출력에서 제외)')) : tr('목록에서 제거'),
|
||||
iconSize: 18,
|
||||
onPressed: locked ? null : () => c.removeSubtitle(v, s),
|
||||
icon: Icon(
|
||||
embedded && off ? Icons.undo : Icons.delete_outline,
|
||||
color: JjColors.textDim,
|
||||
),
|
||||
),
|
||||
];
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
|
|
@ -1300,71 +1375,31 @@ class _SubtitleRow extends StatelessWidget {
|
|||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: JjColors.border),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: (embedded ? JjColors.textDim : JjColors.accent)
|
||||
.withValues(alpha: 0.18),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(embedded ? tr('내장') : tr('외부'),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: embedded ? JjColors.textDim : JjColors.accent)),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
s.displayName,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: off ? JjColors.textDim : JjColors.text,
|
||||
decoration: off ? TextDecoration.lineThrough : null,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_LanguageDropdown(
|
||||
value: s.language,
|
||||
onChanged: locked || off ? null : (l) => c.setLanguage(s, l),
|
||||
),
|
||||
if (!embedded) ...[
|
||||
child: LayoutBuilder(builder: (context, box) {
|
||||
final fits = box.maxWidth >= _oneLineWidth(context, embedded: embedded, buttons: buttons.length);
|
||||
if (fits) {
|
||||
// 넓을 때: 지금처럼 한 줄
|
||||
return Row(children: [
|
||||
badge,
|
||||
const SizedBox(width: 10),
|
||||
Expanded(child: name),
|
||||
const SizedBox(width: 8),
|
||||
_CharsetDropdown(
|
||||
value: s.charset ?? 'UTF-8',
|
||||
onChanged: locked ? null : (cs) => c.setCharset(s, cs),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 4),
|
||||
IconButton(
|
||||
tooltip: c.canEdit(s) ? tr('내용 편집 · 문자셋 변환') : tr('이미지 자막은 편집할 수 없습니다'),
|
||||
iconSize: 18,
|
||||
onPressed: locked || off || !c.canEdit(s)
|
||||
? null
|
||||
: () => openSubtitleEditor(context, c, v, s),
|
||||
icon: const Icon(Icons.edit_note, color: JjColors.accent),
|
||||
for (final (i, x) in pickers.indexed) ...[if (i > 0) const SizedBox(width: 8), x],
|
||||
const SizedBox(width: 4),
|
||||
...buttons,
|
||||
]);
|
||||
}
|
||||
// 좁아 넘칠 때만 두 줄: 위 = 내장 표 · 트랙 이름, 아래 = 언어 고르기 · 단추 (언어 이름은 줄이지 않는다 - 무엇을 골랐는지 보이게)
|
||||
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Row(children: [badge, const SizedBox(width: 10), Expanded(child: name)]),
|
||||
const SizedBox(height: 2),
|
||||
Wrap(
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
spacing: 8,
|
||||
children: [...pickers, Row(mainAxisSize: MainAxisSize.min, children: buttons)],
|
||||
),
|
||||
if (c.services.createTranslator != null)
|
||||
IconButton(
|
||||
tooltip: c.canEdit(s) ? trf('다른 언어로 번역 (AI · 이 {0}에서)', [Platform.isAndroid ? tr('기기') : 'PC']) : tr('이미지 자막은 번역할 수 없습니다'),
|
||||
iconSize: 18,
|
||||
onPressed: locked || off || !c.canEdit(s) ? null : () => showTranslateDialog(context, c, v, s),
|
||||
icon: const Icon(Icons.translate, color: JjColors.accent),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: embedded ? (off ? tr('되살리기') : tr('삭제 (출력에서 제외)')) : tr('목록에서 제거'),
|
||||
iconSize: 18,
|
||||
onPressed: locked ? null : () => c.removeSubtitle(v, s),
|
||||
icon: Icon(
|
||||
embedded && off ? Icons.undo : Icons.delete_outline,
|
||||
color: JjColors.textDim,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue