mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 23:00:44 +00:00
琚帶绔?- 淇 MTU 闂锛氬す MSS + 璺緞 MTU 鎺㈡祴锛堝叕缃戝彲鐢ㄧ巼 48% -> 100%锛?- 澶嶇敤 HTTP 杩炴帴锛堝厤鎺夋瘡娆℃柊寤?TLS 鐨?30% 鎻℃墜澶辫触锛?- 姣忓垎閽熷洖澶存壘灞€鍩熺綉锛岃嚜鍔ㄥ垏鍥炲揩 400 鍊嶇殑璺緞 - 鐢婚潰蹇冭烦甯э細闈欐鏃剁渷娴侀噺锛屽鎴风浠嶇煡閬撴祦鏄椿鐨?- 閿佸睆鏃剁粰鍑哄彲鎿嶄綔鐨勬彁绀? 鎵嬭〃绔?- 鍐呯疆 GTS Root R4 / GlobalSign Root CA锛屼慨 SSLHandshakeException - 杩炴帴閿欒缈昏瘧鎴愪汉璇濓紙璇佷功/鏃堕棿/瑙f瀽/瓒呮椂鍒嗗埆鎻愮ず锛?- 缁忎腑杞繛涓婂悗鐢ㄦ湇鍔″櫒鎶ョ殑鍦板潃鍒锋柊宸查厤瀵硅褰?- 鏂板灞€鍩熺綉杩炴帴椤甸潰銆佹湇鍔″櫒寤惰繜妫€娴? 鏈嶅姟鍣ㄧ - 鏀寔 chunked 璇锋眰浣擄紙淇瘡 16 绉掍竴娆$殑杩炴帴閿欎贡涓庡ぇ闈㈢Н 502锛?- 缃戠粶璋冧紭鑴氭湰 net-tune.sh锛堝紑鏈鸿嚜鍔ㄥ簲鐢級 - 绠$悊椤碉細鎵归噺鍒犻櫎銆佺綉缁滀綋妫€銆佷笅杞藉尯 - 闅ч亾鏀?HTTP/2 + 鍙岃繛鎺? 鏂囨。 - 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
127 lines
5.1 KiB
Python
127 lines
5.1 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""1. 修一下说明文字的换行宽度
|
||
2. 给首次设置窗口的测试加"卡片必须真的显示出来"的断言
|
||
|
||
第 2 点很关键:
|
||
我之前写的 _card() 返回了内层 frame,而内层挂在从未被 pack 的
|
||
外层里 —— 卡片完全不显示(窗口只有 199px 高)。
|
||
但控件都"存在",walk 能列出来,原来的测试全过。
|
||
|
||
只有断言"窗口够高" + "子控件是 mapped 的"才能抓到。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import ast
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
||
UI = ROOT / "windows" / "lanremote" / "ui.py"
|
||
TEST = ROOT / "_tests" / "test_first_run_setup.py"
|
||
|
||
# ---------------- 1. 换行宽度 ----------------
|
||
WRAP_OLD = ''' tk.Label(opt_inner,
|
||
text="没放行成功的话,配对码不会提交给服务器,"
|
||
"会告诉你怎么处理。",
|
||
bg=CARD, fg=MUTED, font=FONT_SMALL, justify="left",
|
||
wraplength=340).pack(anchor="w", pady=(6, 0))'''
|
||
WRAP_NEW = ''' tk.Label(opt_inner,
|
||
text="没放行成功的话,配对码不会提交给服务器,"
|
||
"会告诉你怎么处理。",
|
||
bg=CARD, fg=MUTED, font=FONT_SMALL, justify="left",
|
||
wraplength=396).pack(anchor="w", pady=(6, 0))'''
|
||
|
||
# ---------------- 2. 测试断言 ----------------
|
||
TEST_ANCHOR = ''' check("设置窗口有输入框", found.get("entries", 0) >= 1, str(found))'''
|
||
|
||
TEST_NEW = ''' # ---- 界面必须真的显示出来 ----
|
||
# 踩过的坑:_card() 返回了内层 frame,内层挂在从未 pack 的外层里,
|
||
# 于是两张卡片完全不显示,窗口只有 199px 高 —— 但控件都在,
|
||
# 光数控件个数查不出来。所以这里断言"够高 + 子控件是 mapped 的"。
|
||
metrics = found.get("metrics", {})
|
||
print(f" 窗口 {metrics.get('width')}x{metrics.get('height')},"
|
||
f"mapped 子控件 {metrics.get('mapped')}/{metrics.get('children')}")
|
||
check("设置窗口够高(卡片真的画出来了)",
|
||
(metrics.get("height") or 0) >= 400,
|
||
f"高度只有 {metrics.get('height')}(<400 说明卡片没显示)")
|
||
check("有多个子控件被真正映射(mapped)",
|
||
(metrics.get("mapped") or 0) >= 2, metrics)
|
||
check("配对码输入框是可见的",
|
||
metrics.get("entry_mapped") is True, metrics)
|
||
|
||
check("设置窗口有输入框", found.get("entries", 0) >= 1, str(found))'''
|
||
|
||
# 在 ready() 里收集 metrics
|
||
READY_OLD = ''' def ready(win):
|
||
parts = inspect(win)
|
||
found["entries"] = len(parts["entries"])
|
||
found["checks"] = len(parts["checks"])
|
||
found["buttons"] = len(parts["buttons"])
|
||
found["labels"] = parts["labels"]
|
||
found["confirmed"] = fill_and_confirm(win, "789113")'''
|
||
|
||
READY_NEW = ''' def ready(win):
|
||
root = win.root
|
||
# 多刷几轮,等布局稳定(刚建好时 winfo_width 还可能是初始值)
|
||
for _ in range(6):
|
||
root.update_idletasks()
|
||
root.update()
|
||
time.sleep(0.2)
|
||
|
||
parts = inspect(win)
|
||
found["entries"] = len(parts["entries"])
|
||
found["checks"] = len(parts["checks"])
|
||
found["buttons"] = len(parts["buttons"])
|
||
found["labels"] = parts["labels"]
|
||
|
||
children = root.winfo_children()
|
||
found["metrics"] = {
|
||
"width": root.winfo_width(),
|
||
"height": root.winfo_height(),
|
||
"children": len(children),
|
||
"mapped": sum(1 for c in children if c.winfo_ismapped()),
|
||
"reqheight": root.winfo_reqheight(),
|
||
"entry_mapped": any(e.winfo_ismapped() for e in parts["entries"]),
|
||
}
|
||
found["confirmed"] = fill_and_confirm(win, "789113")'''
|
||
|
||
|
||
def main() -> int:
|
||
ok = True
|
||
|
||
text = UI.read_text(encoding="utf-8")
|
||
if WRAP_OLD in text:
|
||
text = text.replace(WRAP_OLD, WRAP_NEW, 1)
|
||
UI.write_text(text, encoding="utf-8", newline="\n")
|
||
print(" ui.py:说明文字换行宽度 340 -> 396")
|
||
else:
|
||
print(" ui.py:换行宽度锚点没找到(可能已改)")
|
||
|
||
text = TEST.read_text(encoding="utf-8")
|
||
changed = 0
|
||
for old, new in ((READY_OLD, READY_NEW), (TEST_ANCHOR, TEST_NEW)):
|
||
if old in text:
|
||
text = text.replace(old, new, 1)
|
||
changed += 1
|
||
else:
|
||
print(f" [失败] 测试锚点没找到 -> {old.strip()[:60]}")
|
||
ok = False
|
||
if changed:
|
||
TEST.write_text(text, encoding="utf-8", newline="\n")
|
||
print(f" 测试:加了 {changed} 处界面可见性断言")
|
||
|
||
# 确认测试里有 time 导入
|
||
if "import time" not in text:
|
||
text = text.replace("import tempfile", "import tempfile\nimport time", 1)
|
||
TEST.write_text(text, encoding="utf-8", newline="\n")
|
||
print(" 测试:补了 import time")
|
||
|
||
ast.parse(UI.read_text(encoding="utf-8"))
|
||
ast.parse(TEST.read_text(encoding="utf-8"))
|
||
print(" 语法都 OK")
|
||
return 0 if ok else 1
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|