시험: Wi-Fi 공유를 끈 뒤 (손으로 · 저절로) 그 포트로 더는 안 열림 · 16진 보기 412 는 한 줄 8바이트 (검토 대기)

관리자 지시 (10/20) 2번 - 위키 974 목록에서 "🧪 ·" 만 적혀 있고 실제 시험이 없던 것:
- 2절 "[끄기] → 다른 기기에서 더는 안 열림 · 30분이 지나면 저절로 꺼짐": 꺼진 것 (running) 만 보던 것을 그 포트에
  실제로 연결해 막히는지까지 (손으로 끄기 · 저절로 꺼짐 둘 다).
- 3절 "16진 - 폰 세로는 한 줄 8바이트": 412 폭은 둘째 줄이 00000008, 960 폭은 00000010. 글자 칸이 화면 안인지는 실제 글꼴이
  필요해 Windows 캡처 (15) 몫 (시험 글꼴은 모든 글자가 정사각형).
코드 변경 없음 - 둘 다 통과.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wiki_tests
RyuJongJin 2026-10-20 13:28:35 +09:00
parent aba095b342
commit 42738688ec
2 changed files with 43 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:jj_mkvmaker/ui/file_tools.dart';
import 'package:path/path.dart' as p;
import 'package:flutter/material.dart';
/// X-plore 비교 P3: 해시 · 16진 보기 · 폴더 속성
void main() {
@ -27,4 +28,26 @@ void main() {
final s = await folderStats(p.join(tmp.path, 'd'));
expect((s.files, s.folders, s.bytes), (2, 1, 15));
});
testWidgets('위키 974 3절 (10/20): 16진 보기 - 폰 세로 (412) 는 한 줄 8바이트 · 넓으면 16바이트', (tester) async {
final dir = Directory.systemTemp.createTempSync('jj_hex_');
addTearDown(() => dir.deleteSync(recursive: true));
final f = File(p.join(dir.path, 'a.bin'))..writeAsBytesSync([for (var i = 0; i < 40; i++) 0x41 + i % 26]);
for (final (w, per) in [(412.0, 8), (960.0, 16)]) {
tester.view.physicalSize = Size(w, 800);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(MaterialApp(key: ValueKey(w), home: HexViewerPage(path: f.path)));
// 파일은 진짜 입출력으로 읽는다 - 다 읽어 그릴 때까지
for (var i = 0; i < 20 && find.textContaining(RegExp('^00000000 ')).evaluate().isEmpty; i++) {
await tester.runAsync(() => Future<void>.delayed(const Duration(milliseconds: 50)));
await tester.pump();
}
// 둘째 줄의 시작 자리 = per
final second = per.toRadixString(16).padLeft(8, '0');
expect(find.textContaining(RegExp('^$second ')), findsOneWidget, reason: '$w 폭: 한 줄 $per 바이트');
expect(tester.takeException(), isNull);
// 글자 칸까지 화면 안인지는 실제 글꼴로 - Windows 캡처 (15, 412 폭) 가 본다 (시험 글꼴은 모든 글자가 정사각형)
}
});
}

View File

@ -201,4 +201,24 @@ void main() {
expect(WifiShare.isLocalNetwork(ip), isFalse, reason: ip);
}
});
test('위키 974 2절 (10/20): [끄기] · 저절로 꺼진 뒤에는 그 주소 · 포트로 더는 열리지 않는다 (다른 기기에서 안 열림)', () async {
final port = s.port;
final ok = await Socket.connect('127.0.0.1', port);
ok.destroy();
await s.stop();
expect(s.running, isFalse);
await expectLater(Socket.connect('127.0.0.1', port, timeout: const Duration(seconds: 1)), throwsA(isA<SocketException>()),
reason: '[끄기] 뒤');
final t = await WifiShare.start(shared.path, port: 0, autoOff: const Duration(milliseconds: 200), loopbackOnly: true);
s = t;
final port2 = t.port;
(await Socket.connect('127.0.0.1', port2)).destroy();
for (var i = 0; i < 50 && t.running; i++) {
await Future<void>.delayed(const Duration(milliseconds: 20));
}
expect(t.running, isFalse);
await expectLater(Socket.connect('127.0.0.1', port2, timeout: const Duration(seconds: 1)), throwsA(isA<SocketException>()),
reason: '저절로 꺼진 뒤');
});
}