24 lines
1.2 KiB
Dart
24 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
import 'package:jj_mkvmaker/ui/sync_preview_view.dart';
|
||
|
||
/// 관리자 지시 (10/20, 28 지적): 경고 글 안의 옵션 (--filter=H a.txt) 이 좁은 창에서 "--" 와 "filter=…" 로 갈리던 것
|
||
void main() {
|
||
double widest(String s, {bool min = true}) {
|
||
final tp = TextPainter(text: TextSpan(text: s, style: const TextStyle(fontSize: 12)), textDirection: TextDirection.ltr)..layout();
|
||
final w = min ? tp.minIntrinsicWidth : tp.maxIntrinsicWidth;
|
||
tp.dispose();
|
||
return w;
|
||
}
|
||
|
||
test('옵션 글은 줄바꿈 자리가 없다 (가장 좁게 접어도 한 줄 폭)', () {
|
||
for (final o in ['--filter=H a.txt', '-f"- *.log"', '--files-from=list/a b.txt', '-C']) {
|
||
final u = unbreakableOption(o);
|
||
expect(widest(u), closeTo(widest(u, min: false), 0.01), reason: o);
|
||
expect(u.replaceAll('', '').replaceAll(' ', ' '), o, reason: '보이는 글은 그대로');
|
||
}
|
||
// 묶지 않은 글은 줄이 갈릴 수 있다 (시험이 실제로 무언가를 보는지)
|
||
expect(widest('--filter=H a.txt'), lessThan(widest('--filter=H a.txt', min: false)));
|
||
});
|
||
}
|