ElyShow: a real-window check that the show covers the whole screen (R2.5)
This commit is contained in:
2 files changed
+55
No files matched your search
@@ -166,6 +166,7 @@ tests/scripts/recovery.sh 真窗口 ElyDoc:恢复点、崩溃后副本、
|
||||
tests/scripts/pdf-recovery.sh 真窗口 ElyPDF:加锁文件的封存恢复点、空闲引擎退出后重开时再问密码(需辅助功能权限)
|
||||
tests/scripts/autosave.sh 真窗口 ElyDoc:自动保存开关、停手即写、外部改动不覆盖(需辅助功能权限)
|
||||
tests/scripts/print.sh 真窗口 ElyDoc:打印用文档自己的纸张,取消不动文档(需辅助功能权限)
|
||||
tests/scripts/show-fullscreen.sh 真窗口 ElyShow:F5 放映的窗口盖住整块屏幕(菜单栏与程序坞之上,需辅助功能权限)
|
||||
tests/scripts/types.sh packaging/types.tsv 的文件类型在 Linux 桌面项、Windows 安装程序与 macOS 文档类型里一致,从不设为默认
|
||||
tests/scripts/layout.sh 真窗口:六个应用在 640、800、1100 宽下无元素越出窗口左右,留截图(需辅助功能与屏幕录制权限)
|
||||
tests/scripts/ooxml.py <用例> <文件> 不经 LibreOffice 读 DOCX、XLSX、PPTX 并按自算的预期核对(往返用例调用)
|
||||
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
# ElyShow slide show: on macOS it covers the menu bar and Dock.
|
||||
set -euo pipefail
|
||||
|
||||
root=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
[ "$(uname)" = Darwin ] || { echo "SKIP: macOS only"; exit 0; }
|
||||
work=$(mktemp -d)
|
||||
cleanup() {
|
||||
local status=$?
|
||||
if [ -n "${pid:-}" ]; then
|
||||
pkill -9 -P "$pid" 2>/dev/null || true
|
||||
kill "$pid" 2>/dev/null || true
|
||||
wait "$pid" 2>/dev/null || true
|
||||
fi
|
||||
[ "$status" = 0 ] && rm -rf "$work" || echo "kept $work" >&2
|
||||
exit "$status"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
fail() {
|
||||
echo "FAIL: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cargo build -q -p ely-lok --bins -p ely-show --manifest-path "$root/Cargo.toml"
|
||||
osascript -e 'tell application "System Events" to get name of first process' >/dev/null 2>&1 ||
|
||||
{ echo "SKIP: needs Accessibility permission"; exit 0; }
|
||||
cp "$root/tests/fixtures/office/t.pptx" "$work/deck.pptx"
|
||||
mkdir -p "$work/home"
|
||||
HOME="$work/home" ELY_LOG=info ELY_LOCALE=en ELY_NO_DIALOG=1 "$root/target/debug/ely-show" "$work/deck.pptx" >"$work/out" 2>&1 &
|
||||
pid=$!
|
||||
# The screen the show fills, in points.
|
||||
screen=$(swift -e 'import AppKit; let f = NSScreen.screens[0].frame; print(Int(f.width), Int(f.height))')
|
||||
windows() {
|
||||
osascript -e "tell application \"System Events\" to tell (first process whose unix id is $pid)" \
|
||||
-e 'set out to ""' \
|
||||
-e 'repeat with w in windows' \
|
||||
-e 'set {x, y} to position of w' \
|
||||
-e 'set {a, b} to size of w' \
|
||||
-e 'set out to out & x & " " & y & " " & a & " " & b & linefeed' \
|
||||
-e 'end repeat' -e 'return out' -e 'end tell' 2>/dev/null || true
|
||||
}
|
||||
for _ in $(seq 60); do
|
||||
grep -q "lok: tile" "$work/out" 2>/dev/null && [ -n "$(windows)" ] && break
|
||||
sleep 1
|
||||
done
|
||||
osascript -e "tell application \"System Events\" to set frontmost of (first process whose unix id is $pid) to true" -e 'delay 1' \
|
||||
-e 'tell application "System Events" to key code 96' >/dev/null
|
||||
for _ in $(seq 20); do
|
||||
windows | grep -qx "0 0 $screen" && break
|
||||
sleep 1
|
||||
done
|
||||
windows | grep -qx "0 0 $screen" || fail "no show window covers the screen ($screen): $(windows | tr '\n' ';')"
|
||||
osascript -e 'tell application "System Events" to key code 53' >/dev/null
|
||||
echo "ok: the show covers the whole screen"
|
||||
Reference in new issue
Block a user