Skip to content

Commit b2a0b4e

Browse files
test viewer
1 parent 05be650 commit b2a0b4e

1 file changed

Lines changed: 31 additions & 8 deletions

File tree

.github/workflows/test.yaml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,43 @@ jobs:
2828

2929
- name: Build
3030
run: cargo build --locked --features cli --bins --all-targets
31-
31+
3232
- name: Headless smoke test (Linux/macOS)
3333
if: runner.os != 'Windows'
3434
shell: bash
3535
run: |
36-
BIN="target/debug/asimov-image-viewer"
37-
# already built above; no rebuild/race
38-
JSON='{"id":"test","source":"test","width":2,"height":2,"data":[255,0,0, 0,255,0, 0,0,255, 255,255,255]}'
39-
printf '%s\n' "$JSON" | "$BIN" --headless
36+
set -euo pipefail
37+
BIN_VIEWER="target/debug/asimov-image-viewer"
38+
BIN_READER="target/debug/asimov-image-reader"
39+
40+
# Make a 2x2 ASCII PPM (P3)
41+
cat > test.ppm <<'PPM'
42+
P3
43+
2 2
44+
255
45+
255 0 0 0 255 0
46+
0 0 255 255 255 255
47+
PPM
48+
49+
# Reader prints one JSON-LD line -> pipe to viewer (headless)
50+
"$BIN_READER" test.ppm | "$BIN_VIEWER" --headless --verbose
4051
4152
- name: Headless smoke test (Windows PowerShell)
4253
if: runner.os == 'Windows'
4354
shell: pwsh
4455
run: |
45-
$bin = "target\debug\asimov-image-viewer.exe"
46-
$json = '{"id":"test","source":"test","width":2,"height":2,"data":[255,0,0, 0,255,0, 0,0,255, 255,255,255]}'
47-
$json | & $bin --headless
56+
$ErrorActionPreference = "Stop"
57+
$viewer = "target\debug\asimov-image-viewer.exe"
58+
$reader = "target\debug\asimov-image-reader.exe"
59+
60+
# Create 2x2 PPM (ASCII P3)
61+
@'
62+
P3
63+
2 2
64+
255
65+
255 0 0 0 255 0
66+
0 0 255 255 255 255
67+
'@ | Set-Content -NoNewline -Encoding ascii test.ppm
68+
69+
# Pipe real JSON-LD from reader into viewer
70+
& $reader test.ppm | & $viewer --headless --verbose

0 commit comments

Comments
 (0)