From 114769d24709114098b25a52dce36a961aa10b16 Mon Sep 17 00:00:00 2001 From: RyuJongJin <266630912+RyuJongJin@users.noreply.github.com> Date: Sun, 25 Oct 2026 04:32:10 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8B=9C=ED=97=98:=20Wi-Fi=20=EA=B3=B5?= =?UTF-8?q?=EC=9C=A0=EB=A5=BC=20=EB=81=88=20=EB=92=A4=20(=EC=86=90?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=C2=B7=20=EC=A0=80=EC=A0=88=EB=A1=9C)=20?= =?UTF-8?q?=EA=B7=B8=20=ED=8F=AC=ED=8A=B8=EB=A1=9C=20=EB=8D=94=EB=8A=94=20?= =?UTF-8?q?=EC=95=88=20=EC=97=B4=EB=A6=BC=20=C2=B7=2016=EC=A7=84=20?= =?UTF-8?q?=EB=B3=B4=EA=B8=B0=20412=20=EB=8A=94=20=ED=95=9C=20=EC=A4=84=20?= =?UTF-8?q?8=EB=B0=94=EC=9D=B4=ED=8A=B8=20(4273868,=20wiki=5Ftests=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=98=AE=EA=B9=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - wifi_share_test: [끄기] 뒤 · 저절로 꺼진 뒤 그 포트에 실제로 연결해 막히는지 (시험 망은 loopbackOnly 대신 지금의 주입 LoopbackNet) - file_tools_test: 16진 보기 412 폭은 둘째 줄이 00000008, 960 폭은 00000010 - 코드 변경 없음 - 둘 다 2회 통과 (analyze 0) Co-Authored-By: Claude Opus 5.5 --- test/file_tools_test.dart | 24 ++++++++++++++++++++++++ test/wifi_share_test.dart | 21 +++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/test/file_tools_test.dart b/test/file_tools_test.dart index 2c70bec..8fec494 100644 --- a/test/file_tools_test.dart +++ b/test/file_tools_test.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:jj_mkvmaker/ui/file_tools.dart'; import 'package:path/path.dart' as p; @@ -27,4 +28,27 @@ void main() { final s = await folderStats(p.join(tmp.path, 'd')); expect((s.files, s.folders, s.bytes), (2, 1, 15)); }); + + // 4273868 (wiki_tests) 에서 옮김 + 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.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 폭) 가 본다 (시험 글꼴은 모든 글자가 정사각형) + } + }); } diff --git a/test/wifi_share_test.dart b/test/wifi_share_test.dart index 059191b..b085c8c 100644 --- a/test/wifi_share_test.dart +++ b/test/wifi_share_test.dart @@ -215,4 +215,25 @@ void main() { expect(WifiShare.isLocalNetwork(ip), isFalse, reason: ip); } }); + + // 4273868 (wiki_tests) 에서 옮김 - 시험 망은 loopbackOnly 대신 지금의 주입 LoopbackNet + 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()), + reason: '[끄기] 뒤'); + final t = await WifiShare.start(shared.path, port: 0, autoOff: const Duration(milliseconds: 200), net: LoopbackNet()); + 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.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()), + reason: '저절로 꺼진 뒤'); + }); }