Skip to content

Commit 6e99b03

Browse files
committed
[D6] Ghost accept formatting test aligns with Deep overlay
1 parent 12b9599 commit 6e99b03

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

issues/2026-02-10_23-01-37-ui-autosave-streaming-v2.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ D2,Scratch autosave/restore + flush on close,Persist unbound scratch editor cont
44
D3,Bottom status bar separator/overlap cleanup,Reduce stacked separator lines and clipping in EnhancedStatusBar. Use a single separator strategy (either borders or VLines) with consistent heights/margins and remove duplicate/overlapping lines. Update status bar layout test accordingly.,Bottom bar shows a single clean row; no stacked/thick separator lines; labels are not clipped; test passes.,.tmp\\ane0305-venv-311\\Scripts\\python.exe -m pytest -q tests/test_status_bar_layout.py,none,DONE,DONE,TODO,src/gui/status/status_bar.py | tests/test_status_bar_layout.py,none,user_report: bottom bar lines stacked/overlapping | test:.tmp\\ane0305-venv-311\\Scripts\\python.exe -m pytest -q tests/test_status_bar_layout.py PASS | done_at:2026-02-10
55
D4,"Max tokens UI supports >=1,000,000","Ensure AI配置中心的最大tokens输入允许很大的值(>=1,000,000)且不会出现输入首位数字就被限制/截断的问题;保存/加载配置保持一致。添加pytest-qt回归测试。","Max tokens can be set to 1,000,000+ and persists after reopening AI配置中心; regression test passes.",.tmp\\ane0305-venv-311\\Scripts\\python.exe -m pytest -q tests/test_ai_config_max_tokens_range.py,none,DONE,DONE,TODO,src/gui/ai/unified_ai_config_dialog.py | tests/test_ai_config_max_tokens_range.py,none,user_report: max_tokens max=3999 and typing '4' clamps; verify and prevent regression | test:.tmp\\ane0305-venv-311\\Scripts\\python.exe -m pytest -q tests/test_ai_config_max_tokens_range.py PASS | done_at:2026-02-10
66
D5,Verify provider streaming specs + docs/tests,Use official docs (OpenAI/Anthropic/Gemini) to verify streaming endpoints/headers/params and SSE parsing requirements; adjust provider strategies and AIClient stream parsing if needed; add a short doc summary and tests for OpenAI+Claude streaming fixtures.,Provider streaming endpoints/params match official docs as of 2026-02-10; OpenAI/Claude streaming extraction tests pass; doc added.,.tmp\\ane0305-venv-311\\Scripts\\python.exe -m pytest -q tests/test_provider_streaming_openai_claude.py,manual,DONE,DONE,TODO,src/core/ai_client.py | src/core/ai_providers/openai.py | src/core/ai_providers/claude.py | src/core/ai_providers/gemini.py | docs/ai/streaming_providers.md | tests/test_provider_streaming_openai_claude.py,none,requires web research for up-to-date streaming specs; keep tests offline via fixtures | test:.tmp\ane0305-venv-311\Scripts\python.exe -m pytest -q tests/test_provider_streaming_openai_claude.py PASS | doc:docs/ai/streaming_providers.md | done_at:2026-02-10
7+
D6,Ghost accept formatting test aligns with Deep overlay,Update ghost accept formatting regression test to match DeepIntegratedGhostText (non-destructive overlay). Stop relying on OptimalGhostText internal positions/formatting; assert document text unchanged before accept and accepted inserted text uses normal formatting.,tests/test_ghost_text_accept_formatting.py passes; verifies ghost preview does not mutate document and accepted text formatting matches normal text in dark theme.,.tmp\\ane0305-venv-311\\Scripts\\python.exe -m pytest -q tests/test_ghost_text_accept_formatting.py,none,DONE,DONE,TODO,tests/test_ghost_text_accept_formatting.py,none,regression_fail: AttributeError _ghost_start_pos after switching default ghost system to Deep overlay | test:.tmp\ane0305-venv-311\Scripts\python.exe -m pytest -q tests/test_ghost_text_accept_formatting.py PASS | done_at:2026-02-10
8+
D7,Fix AI config delayed model set crash on close,Replace QTimer.singleShot delayed model selection with a dialog-owned QTimer (or guard) so it cannot call into deleted widgets; prevents Qt event loop exceptions during fast open/close flows.,Backup service create-backup-set test runs without Qt event loop exceptions; delayed model set does not crash when dialog closes quickly.,.tmp\\ane0305-venv-311\\Scripts\\python.exe -m pytest -q tests/test_backup_service_create_backup_set.py::test_create_backup_set_backs_up_project_and_vectors,none,TODO,TODO,TODO,src/gui/ai/unified_ai_config_dialog.py,none,regression_fail: QTimer.singleShot calling _set_model_delayed after dialog destroyed -> QComboBox deleted RuntimeError

tests/test_ghost_text_accept_formatting.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def test_ghost_text_accept_restores_normal_formatting():
5050
assert ghost is not None, "Ghost Text manager should be initialized"
5151

5252
# 设置基础正文
53-
editor.setPlainText("Hello world")
53+
base_text = "Hello world"
54+
editor.setPlainText(base_text)
5455

5556
# 取一段普通正文的字符格式作为“正常格式”参考
5657
base_cursor = editor.textCursor()
@@ -62,23 +63,14 @@ def test_ghost_text_accept_restores_normal_formatting():
6263
cursor = editor.textCursor()
6364
cursor.movePosition(QTextCursor.MoveOperation.End)
6465
editor.setTextCursor(cursor)
66+
start = editor.textCursor().position()
6567

6668
suggestion = "Hello world and beyond"
6769
editor.show_ghost_ai_completion(suggestion)
6870

6971
assert ghost.has_active_ghost_text() is True
70-
71-
start = ghost._ghost_start_pos
72-
end = ghost._ghost_end_pos
73-
assert start >= 0 and end > start
74-
75-
ghost_cursor = editor.textCursor()
76-
ghost_cursor.setPosition(start)
77-
ghost_cursor.setPosition(end, QTextCursor.MoveMode.KeepAnchor)
78-
ghost_format = ghost_cursor.charFormat()
79-
80-
# 接受前:Ghost Text 应该有单独的前景色属性
81-
assert ghost_format.hasProperty(QTextFormat.Property.ForegroundBrush) is True
72+
# DeepIntegratedGhostText uses a non-destructive overlay preview: document text must be unchanged.
73+
assert editor.toPlainText() == base_text
8274

8375
# 模拟按 Tab 接受 Ghost Text
8476
tab_event = QKeyEvent(
@@ -90,8 +82,11 @@ def test_ghost_text_accept_restores_normal_formatting():
9082

9183
# 接受后:Ghost Text 状态应被清理
9284
assert ghost.has_active_ghost_text() is False
85+
assert editor.toPlainText() == suggestion
9386

9487
accepted_cursor = editor.textCursor()
88+
expected_insert = suggestion[len(base_text) :]
89+
end = start + len(expected_insert)
9590
accepted_cursor.setPosition(start)
9691
accepted_cursor.setPosition(end, QTextCursor.MoveMode.KeepAnchor)
9792
accepted_format = accepted_cursor.charFormat()

0 commit comments

Comments
 (0)