VIP loop (circle → extract → Translate/Copy/Explain/Share/Vikunja), lasso branding, ship docs, unit tests, and make smoke / launchd emu helpers.
87 lines
2.9 KiB
Bash
Executable File
87 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Device/emulator smoke: unit tests already cover JVM; this hits the live overlay.
|
|
# Requires: adb device online, Circle Overlay enabled (or we enable it).
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
ADB="${ADB:-adb}"
|
|
COMP='com.example.crkl/com.example.crkl.accessibility.CrklAccessibilityService'
|
|
PKG=com.example.crkl
|
|
|
|
die() { echo "FAIL: $*" >&2; exit 1; }
|
|
pass() { echo "OK: $*"; }
|
|
|
|
"$ADB" devices | awk '/\tdevice$/{found=1} END{exit !found}' || die "no adb device"
|
|
|
|
echo "== smoke Circle on $($ADB get-serialno) =="
|
|
|
|
"$ADB" shell settings put secure accessibility_enabled 1
|
|
"$ADB" shell settings put secure enabled_accessibility_services "$COMP"
|
|
"$ADB" shell am force-stop "$PKG" >/dev/null 2>&1 || true
|
|
sleep 1
|
|
"$ADB" shell settings put secure enabled_accessibility_services "$COMP"
|
|
"$ADB" shell settings put secure accessibility_enabled 1
|
|
sleep 1.5
|
|
"$ADB" shell am start -n "$PKG/.fixtures.TestFixturesActivity" >/dev/null
|
|
sleep 1.5
|
|
|
|
"$ADB" logcat -c
|
|
# FAB: BOTTOM|END, ~964,2200 on 1080x2400 Pixel-7-ish
|
|
"$ADB" shell input tap 964 2200
|
|
sleep 0.5
|
|
if ! "$ADB" logcat -d -s OverlayView:D | grep -q 'floating button clicked'; then
|
|
# sweep near known FAB frame
|
|
hit=0
|
|
for y in $(seq 2140 20 2280); do
|
|
for x in $(seq 900 20 1030); do
|
|
"$ADB" shell input tap "$x" "$y"
|
|
sleep 0.05
|
|
if "$ADB" logcat -d -s OverlayView:D | grep -q 'floating button clicked'; then
|
|
hit=1
|
|
break 2
|
|
fi
|
|
done
|
|
done
|
|
[[ "$hit" = 1 ]] || die "FAB not clickable — is Circle Overlay ON?"
|
|
fi
|
|
pass "enter circle mode"
|
|
|
|
# Closed loop around fixtures email subject region
|
|
python3 - <<'PY'
|
|
import math, subprocess, time
|
|
adb = lambda *a: subprocess.check_call(["adb", *a])
|
|
cx, cy, r = 540, 1720, 160
|
|
n = 28
|
|
pts = [
|
|
(
|
|
int(cx + r * math.cos(2 * math.pi * i / n - math.pi / 2)),
|
|
int(cy + r * math.sin(2 * math.pi * i / n - math.pi / 2)),
|
|
)
|
|
for i in range(n + 1)
|
|
]
|
|
adb("shell", "input", "motionevent", "DOWN", str(pts[0][0]), str(pts[0][1]))
|
|
for x, y in pts[1:]:
|
|
adb("shell", "input", "motionevent", "MOVE", str(x), str(y))
|
|
adb("shell", "input", "motionevent", "UP", str(pts[-1][0]), str(pts[-1][1]))
|
|
for _ in range(25):
|
|
time.sleep(0.3)
|
|
out = subprocess.check_output(["adb", "logcat", "-d"], text=True)
|
|
if "stub path" in out or "Selection ready" in out:
|
|
break
|
|
PY
|
|
|
|
"$ADB" logcat -d | grep -q 'Selection ready' || die "no selection"
|
|
"$ADB" logcat -d | grep -qE 'extract:.*chars=[1-9]' || die "no text extracted"
|
|
pass "circle → extract"
|
|
|
|
"$ADB" logcat -c
|
|
# Copy is second VIP chip (~x=320, y=2185 on this skin)
|
|
"$ADB" shell input tap 320 2185
|
|
sleep 1
|
|
"$ADB" logcat -d | grep -q 'action kind=COPY' || die "Copy chip not triggered"
|
|
"$ADB" logcat -d | grep -q 'action result ok=true' || die "Copy failed"
|
|
pass "Copy chip"
|
|
|
|
echo "== smoke PASSED =="
|
|
echo "Tip: full dogfood is docs/dogfood.md (Translate / Explain / Share / Vikunja / real app)."
|