ElyMark: each print job logs its outcome; the test checks both jobs (M-04)
The window test now saves print jobs to a file (ELY_PRINT_TO) and requires two distinct jobs printed ok and readable PDF text, not a count of Chromium's log lines. It runs on macOS only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d5f94e6e7a
commit
fa5c0b7a75
5 files changed
+22
-18
No files matched your search
@@ -332,6 +332,7 @@ impl Desk {
|
||||
let heard = cx.subscribe(&view, move |desk, view, event: &Event, cx| match event {
|
||||
Event::Loaded => view.read(cx).print_pdf(&job.pdf),
|
||||
Event::Printed(path, ok) => {
|
||||
log::info!("mark: job {n} printed {}, ok {ok}", path.display());
|
||||
desk.printing.remove(&n);
|
||||
let printed = ok
|
||||
.then(|| path.clone())
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@
|
||||
- [x] M-01 键入期间外部以相同内容重写文件,丢掉上次停顿之后键入的全部文字 — 先等页面送出未送的键;同文只接过文件与字节、标签为已保存;磁盘回到上次保存的文字时保留编辑并恢复自动保存;R1–R4 字节、自动保存、在途写入、已保存基线;R5 PASS
|
||||
- [x] M-02 `refresh` 归零版本计数却不换代,在途的一键让标签一直“未落定” — 刷新即换代、归零并结束欠下的渲染(tally.rs);R1 渲染回调悬空、无在途消息的测试;R2 测试未证旧代归零;R3 PASS
|
||||
- [x] M-03 干净标签接过磁盘文字后关闭仍问“是否保存” — 接过磁盘文字的各路(同文、干净重载、合并)都经 adopt_disk,标签与视图的保存基线同设;R1 合并采用未同步视图基线;R2 注释超长;R3 PASS
|
||||
- [ ] M-04 第二次打印或导出 PDF 悄悄取消第一次,没有文件也没有错误
|
||||
- [x] M-04 第二次打印或导出 PDF 悄悄取消第一次,没有文件也没有错误 — 每份打印与导出各有编号与文件,作业按编号保留、互不取消;每份作业完成时记下编号与结果;R1 窗口测试只数日志;R2 PASS(窗口测试只在 macOS,本机未运行)
|
||||
- [ ] M-05 点页面里的链接什么也不发生
|
||||
- [ ] M-06 `on_app_quit` 无条件删恢复点与崩溃锁,AppKit 直接终止时丢未保存内容
|
||||
- [ ] M-07 崩溃恢复的未命名副本按“第一个显示的未命名标签”配对,内容可能落错标签
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
FAIL
|
||||
|
||||
tests/scripts/mark-output.sh:199 — M-04 的并发回归只数 `web: printed` 日志,没有核对成功、作业身份、PDF 内容或系统打印面板;该日志在 CEF 回调中写出,早于 `Desk` 接收 `Event::Printed`。具体失败场景:两次打印均回报 `ok false`,没有生成 PDF、没有打开打印面板,测试仍通过;即使第一份完成事件无人接收,仅留下 CEF 日志,也无法被这条断言发现。本轮在 WSL 提取并执行原测试第 193–203 行,以两个 `web: printed /missing/print-N.pdf ok false` 回报替代实际打印,未创建文件或面板,检查仍以 0 退出;这是断言探针,未运行 macOS 窗口测试。现有 Cargo 测试也没有覆盖并发打印作业的保留与交付。修复方向:可控地让两份作业重叠并分别完成,验证第一份仍被保留、各自完成事件交付成功、输出路径不同且内容对应请求;窗口测试须确认两份可读 PDF 或两次真实打印面板,不能把任意完成日志当成成功。
|
||||
@@ -0,0 +1 @@
|
||||
PASS
|
||||
@@ -42,7 +42,7 @@ git -C "$repo" -c user.name=t -c user.email=t@e.x add -A
|
||||
git -C "$repo" -c user.name=t -c user.email=t@e.x commit -qm one
|
||||
original=$(cat "$doc")
|
||||
launch() {
|
||||
ELY_LOG=info ELY_LOCALE=en ELY_NO_DIALOG=1 HOME="$work" \
|
||||
ELY_LOG=info ELY_LOCALE=en ELY_NO_DIALOG=1 HOME="$work" ELY_PRINT_TO="$work/printed.pdf" \
|
||||
"$root/target/debug/ely-mark" "$@" >"$work/log" 2>&1 &
|
||||
app=$!
|
||||
waits "mark: shown as"
|
||||
@@ -183,24 +183,23 @@ pdftotext "$repo/t.pdf" - | grep -q "END MARK" || fail "the PDF lacks text"
|
||||
[ "$(grep -c 'without 1 images' "$work/log")" -ge 3 ] || fail "the PDF hid a missing image"
|
||||
export_as "Plain Text"
|
||||
grep -q 'x^2' "$repo/t.txt" && grep -qx 'RAW TEXT' "$repo/t.txt" && grep -qx 'TWO' "$repo/t.txt" && grep -q 'END MARK' "$repo/t.txt" || fail "the text: $(cat "$repo/t.txt")"
|
||||
# Print renders the same page, then the system panel.
|
||||
printed=$(count "web: printed")
|
||||
# Print saves each job to a file here.
|
||||
done_ok() { count "office: print done, printed true"; }
|
||||
printed=$(done_ok)
|
||||
key 'keystroke "p" using command down'
|
||||
for _ in $(seq 60); do [ "$(count "web: printed")" -gt "$printed" ] && break; sleep 0.25; done
|
||||
[ "$(count "web: printed")" -gt "$printed" ] || fail "print made no PDF"
|
||||
sleep 2
|
||||
key 'key code 53'
|
||||
# Two prints at once: the second never cancels the first.
|
||||
sleep 1
|
||||
printed=$(count "web: printed")
|
||||
for _ in $(seq 60); do [ "$(done_ok)" -gt "$printed" ] && break; sleep 0.25; done
|
||||
[ "$(done_ok)" -gt "$printed" ] || fail "print made no job: $(grep -E "mark: job|print" "$work/log" | tail -n 4)"
|
||||
pdftotext "$work/printed.pdf" - | grep -q "END MARK" || fail "the printed job lacks the text"
|
||||
# Two prints at once: each job renders and prints.
|
||||
rm "$work/printed.pdf"
|
||||
printed=$(done_ok)
|
||||
jobs=$(count "mark: job .* ok true")
|
||||
osascript -e 'tell application "System Events" to keystroke "p" using command down' -e 'tell application "System Events" to keystroke "p" using command down' >/dev/null
|
||||
# Panels are modal: close one, then the next prints.
|
||||
for want in 1 2; do
|
||||
for _ in $(seq 80); do [ "$(count "web: printed")" -ge $((printed + want)) ] && break; sleep 0.25; done
|
||||
[ "$(count "web: printed")" -ge $((printed + want)) ] || fail "a second print cancelled the first: $(grep -E "web: printed|print-" "$work/log" | tail -n 6)"
|
||||
sleep 2
|
||||
key 'key code 53'
|
||||
done
|
||||
for _ in $(seq 80); do [ "$(done_ok)" -ge $((printed + 2)) ] && break; sleep 0.25; done
|
||||
[ "$(done_ok)" -ge $((printed + 2)) ] || fail "a second print cancelled the first: $(grep -E "mark: job|print" "$work/log" | tail -n 6)"
|
||||
[ "$(grep -o "mark: job [0-9]* printed .*, ok true" "$work/log" | tail -n 2 | cut -d' ' -f3 | sort -u | wc -l)" -eq 2 ] || fail "the two prints were not two jobs"
|
||||
[ "$(count "mark: job .* ok true")" -ge $((jobs + 2)) ] || fail "a job did not render"
|
||||
pdftotext "$work/printed.pdf" - | grep -q "END MARK" || fail "the last job lacks the text"
|
||||
# Rich copy carries HTML; it overwrites the clipboard.
|
||||
if [ "${ELY_CLIPBOARD_TEST:-}" = 1 ]; then
|
||||
key 'keystroke "f" using command down'
|
||||
|
||||
Reference in new issue
Block a user