mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-23 12:06:28 +01:00
Some checks are pending
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Waiting to run
Python tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
Records every Steam game from launch to exit with gpu-screen-recorder: a jeepney D-Bus watcher on app-steam-app* scopes (game-rec-auto user unit), a $mod+Shift+g hotkey and an i3blocks dot. Failure modes: a daemon-reload no longer ends a live recording (ActiveState is re-checked before removal); a hotkey start with no matching audio stream falls back to the guessed app name and retries without it if gsr rejects it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWVxiT9Y4MhGeKGz9dX
115 lines
3.3 KiB
Bash
Executable File
115 lines
3.3 KiB
Bash
Executable File
#!/usr/bin/env bats
|
|
# game_rec.sh start: which monitor, which audio tracks, which file name.
|
|
# Every program it calls is a stub (game_rec_helpers.bash); nothing records.
|
|
|
|
load game_rec_helpers
|
|
|
|
setup() {
|
|
setup_stubs
|
|
make_launch_client 4044265
|
|
}
|
|
|
|
teardown() {
|
|
teardown_stubs
|
|
}
|
|
|
|
@test "game on DP-2: exact argv, mic + game + desktop tracks in order" {
|
|
make_reaper 4044284 3347910 "$RAT_EXE"
|
|
set_game_window 109051905 0 0 3840 2160
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv DP-2 60 rat-game 'Rat Game.exe'
|
|
grep -qxF 'search --onlyvisible --class ^steam_app_3347910$' "$STUB_DIR/xdotool_calls"
|
|
}
|
|
|
|
@test "game window on HDMI-0 records HDMI-0" {
|
|
make_reaper 4044284 3347910 "$RAT_EXE"
|
|
set_game_window 77 3940 100 1280 720
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv HDMI-0 60 rat-game 'Rat Game.exe'
|
|
}
|
|
|
|
@test "no game window: the focused window's monitor is used" {
|
|
make_reaper 4044284 3347910 "$RAT_EXE"
|
|
set_active_window 88 3840 0 2560 1440
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv HDMI-0 60 rat-game 'Rat Game.exe'
|
|
}
|
|
|
|
@test "no window found at all: DP-2" {
|
|
make_reaper 4044284 3347910 "$RAT_EXE"
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv DP-2 60 rat-game 'Rat Game.exe'
|
|
}
|
|
|
|
@test "no Steam game (launch client only): DP-2, no game track" {
|
|
set_active_window 88 3840 0 2560 1440
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv DP-2 60 desktop
|
|
}
|
|
|
|
@test "game not in --list-application-audio yet: hotkey start names every spelling" {
|
|
make_reaper 4044284 3347910 "$RAT_EXE"
|
|
set_game_window 109051905 0 0 3840 2160
|
|
printf 'vesktop\n' >"$STUB_DIR/apps"
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv DP-2 60 rat-game 'Rat Game.exe|app:Rat Game'
|
|
}
|
|
|
|
@test "hotkey start retries without the guessed game track if the recorder rejects it" {
|
|
make_reaper 4044284 3347910 "$RAT_EXE"
|
|
printf 'vesktop\n' >"$STUB_DIR/apps"
|
|
export GSR_STUB_REJECT_APP=1 GAME_REC_START_GRACE=0.5
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
wait_for_recorder 2
|
|
assert_argv DP-2 60 rat-game
|
|
rec status
|
|
[[ $output != *' auto='* ]]
|
|
}
|
|
|
|
@test "app-audio name matches case-insensitively, list spelling wins" {
|
|
make_reaper 4044284 3347910 "$RAT_EXE"
|
|
set_game_window 109051905 0 0 3840 2160
|
|
printf 'vesktop\nrat game.EXE\n' >"$STUB_DIR/apps"
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv DP-2 60 rat-game 'rat game.EXE'
|
|
}
|
|
|
|
@test "GAME_REC_MONITOR and GAME_REC_FPS override detection" {
|
|
make_reaper 4044284 3347910 "$RAT_EXE"
|
|
set_game_window 109051905 0 0 3840 2160
|
|
GAME_REC_MONITOR=HDMI-0 GAME_REC_FPS=30 rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv HDMI-0 30 rat-game 'Rat Game.exe'
|
|
}
|
|
|
|
@test "output goes under GAME_REC_DIR, created on demand" {
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
[ -d "$GAME_REC_DIR" ]
|
|
grep -qx -- "--output=avail -B1 -- $GAME_REC_DIR" "$STUB_DIR/df_calls"
|
|
}
|
|
|
|
@test "app-audio ignores spaces, punctuation and .exe (Oh Deer lists as OhDeer)" {
|
|
make_reaper 4044284 2708450 '/home/kuhy/.local/share/Steam/steamapps/common/Oh Deer/OhDeer.exe'
|
|
printf 'vesktop\nOhDeer\n' >"$STUB_DIR/apps"
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv DP-2 60 ohdeer OhDeer
|
|
}
|
|
|
|
@test "app-audio also matches the game's Steam directory name" {
|
|
make_reaper 4044284 99 '/home/kuhy/.local/share/Steam/steamapps/common/Some Game/Bin/Win64/SG-Win64-Shipping.exe'
|
|
printf 'vesktop\nsome_game\n' >"$STUB_DIR/apps"
|
|
rec start
|
|
[ "$status" -eq 0 ]
|
|
assert_argv DP-2 60 sg-win64-shipping some_game
|
|
}
|