Files
Classroom_Desktop/tests/test-display-settings.sh
T
ekklesiaandClaude Opus 5 8db5e8dd9f release: the Plasma classroom becomes stable 0.2.0
0.1.50 was taken to the church and the things a container cannot answer
were answered on the hardware: boot, autologin, the panel after a reboot,
panel and browser scaling, Wonder Ink, Parent Call opening in the corner
and reaching the sanctuary with a typed name, readable and silent
notifications, HDMI audio and the volume keys.

The promotion is a fast-forward. The experiment was cut from the
published stable source and never diverged from it, so master reaches
this work without a merge and there is one history.

One thing changed for the release. The channel rules turn around:
classroom-v2 and hyprland are the obsolete channels now and a room on
either comes home to stable, while canary — where the next development
release goes — and any channel somebody named by hand stay where they
were put. A fresh installation has always defaulted to stable.

Nothing else moved. This is the 0.1.50 that was verified, with a version
number and a channel rule.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-13 09:15:00 -05:00

36 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
ROOT="$ROOT" PYTHONPATH="$ROOT/lib" python3 - <<'PY'
import os, pathlib, runpy, subprocess, sys, tempfile
from classroom_config import ui_scale
root = pathlib.Path(os.environ['ROOT'])
helper = runpy.run_path(str(root/'scripts/classroom-set-scale'))
original = '# keep this\nCHANNEL=classroom-v2\nMQTT_PASSWORD=literal $ and = characters\nUI_SCALE=1.25\nCUSTOM=x\nUI_SCALE=1.5\n'
result = helper['updated'](original, 2.0)
assert 'MQTT_PASSWORD=literal $ and = characters\n' in result
assert result.count('UI_SCALE=') == 1
assert helper['updated'](result, 2.0) == result
assert 'CUSTOM=x\n' in result
assert ui_scale({'UI_SCALE': '2'}) == 2
assert ui_scale({'UI_SCALE': '3'}) == 3
for bad in ('nan', 'inf', '-inf', 'oops'):
assert ui_scale({'UI_SCALE': bad}) == 1
assert ui_scale({'UI_SCALE': '999'}) == 3
assert ui_scale({'UI_SCALE': '-1'}) == 0.8
# Run the actual migration's config code in a temporary directory: no services.
script = (root/'scripts/classroom-migrate').read_text()
code = script.split("<<'PY'\n", 1)[1].split('\nPY\n', 1)[0]
with tempfile.TemporaryDirectory() as tmp:
path = pathlib.Path(tmp)/'device.conf'
for channel in ('stable', 'canary', 'hyprland', 'classroom-v2', 'custom'):
path.write_text(original.replace('CHANNEL=classroom-v2', 'CHANNEL='+channel))
subprocess.run([sys.executable, '-c', code, str(path)], check=True, capture_output=True)
# The experiment's channel and hyprland come home to stable;
# everything anybody chose deliberately is left alone.
expected = 'stable' if channel in ('classroom-v2', 'hyprland') else channel
assert 'CHANNEL='+expected+'\n' in path.read_text()
assert 'MQTT_PASSWORD=literal $ and = characters\n' in path.read_text()
print('Display settings: scale bounds, config preservation, idempotence and channel migration passed.')
PY