58 lines
2.1 KiB
Markdown
58 lines
2.1 KiB
Markdown
---
|
|
name: altsnap_jitter_test
|
|
lang: cpp
|
|
domain: tools
|
|
description: "Regression test for multi-viewport window jitter triggered by external window movers (AltSnap on Windows, tiling WMs). Drives glfwSetWindowPos every frame and asserts ImGui viewport tracks the OS pos within 1px."
|
|
tags: [imgui, test, regression, headless]
|
|
uses_functions: []
|
|
uses_types: []
|
|
framework: "imgui"
|
|
entry_point: "main.cpp"
|
|
dir_path: "cpp/apps/altsnap_jitter_test"
|
|
repo_url: ""
|
|
---
|
|
|
|
# altsnap_jitter_test
|
|
|
|
Headless C++ harness para validar el fix de jitter de multi-viewport (AltSnap, tiling WMs).
|
|
|
|
## Que hace
|
|
|
|
1. Arranca `fn::run_app` con viewports ON (config exacta que reproducia el bug).
|
|
2. Tras 8 frames de warmup, mueve la ventana via `glfwSetWindowPos` un step por frame durante 60 frames.
|
|
3. Cada frame muestrea pos OS (`glfwGetWindowPos`) y pos ImGui (`GetMainViewport()->Pos`).
|
|
4. Cuenta divergencias > 1px entre ambos. Cero divergencias = PASS, exit 0.
|
|
5. Reporta tambien clamp del WM (cuando el compositor rechaza la pos pedida).
|
|
|
|
## Run
|
|
|
|
WSL/Linux:
|
|
```bash
|
|
cd cpp && cmake -B build/linux -DFN_BUILD_TESTS=OFF
|
|
cmake --build build/linux --target altsnap_jitter_test -j4
|
|
xvfb-run -a -s "-screen 0 1280x800x24" \
|
|
env LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe \
|
|
build/linux/apps/altsnap_jitter_test/altsnap_jitter_test
|
|
echo "EXIT: $?"
|
|
```
|
|
|
|
Windows (cross-compile + Desktop deploy):
|
|
```bash
|
|
source bash/functions/infra/e2e_run_cpp_windows.sh
|
|
e2e_run_cpp_windows altsnap_jitter_test
|
|
```
|
|
|
|
## Output esperado (PASS)
|
|
|
|
```
|
|
[altsnap_jitter] f=0 target=(200,200) actual=(200,200) vp=(200.0,200.0) sync_d=0 clamp_d=0
|
|
[altsnap_jitter] f=10 target=(240,200) actual=(240,200) vp=(240.0,200.0) sync_d=0 clamp_d=0
|
|
...
|
|
[altsnap_jitter] DONE frames=60 max_sync_divergence=0px max_clamp_divergence=0px bad_sync=0 bad_clamp=0
|
|
[altsnap_jitter] PASS
|
|
```
|
|
|
|
## Criterio de fallo
|
|
|
|
`bad_sync > 0` significa que ImGui viewport->Pos quedo fuera de sincronia con la pos real OS, exactamente la condicion que produce el visible "temblor" cuando AltSnap arrastra la ventana. Ese feedback loop es lo que arregla la patch en `cpp/framework/app_base.cpp` (callback GLFW + per-frame sync de viewports).
|