Skip to content

test(gl): regression coverage for camera angles and Scene.select - #168

Merged
oldrepublicwizard merged 3 commits into
masterfrom
cursor/regression-test-coverage-4ad2
Apr 28, 2026
Merged

test(gl): regression coverage for camera angles and Scene.select#168
oldrepublicwizard merged 3 commits into
masterfrom
cursor/regression-test-coverage-4ad2

Conversation

@cursor

@cursor cursor Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Description

Adds focused regression tests for recent GL scene/camera changes: angle wrapping and smoothing in the module designer camera stack, and Scene.select behavior when callers pass a GITObject.

Type of Change

  • ✅ Test addition or update

Package(s) Affected

  • PyKotor (core library)

Risky behavior now covered

  • Camera.rotate: _wrap_angle_pi behavior for yaw and pitch when clamp=False, including a full (2\pi) yaw delta; inverted lower_limit / upper_limit clamp path (midpoint, no crash).
  • CameraController._lerp_angle: shortest arc across the (\pm\pi) seam (relevant to smoothing after orbit/wrap fixes).
  • CameraController._determine_mode: InputState.pan_button forces pan mode (documented for Ctrl+LMB-style bindings).
  • Scene.select: resolves a GITObject to the RenderObject whose .data matches; clear_existing clears vs append; unknown GIT leaves selection empty when clearing.

Test files added/updated

  • Libraries/PyKotor/tests/gl/test_camera_controller.py — extended.
  • Libraries/PyKotor/tests/gl/test_scene_select.py — new.

Why these tests materially reduce regression risk

Camera math bugs surface as subtle viewport drift, gimbal-like jumps, or wrong smoothing after large rotations; the new tests pin the wrap and shortest-path interpolation contracts. Selection bugs break the editor workflow when code passes GIT instances instead of render wrappers; the new tests lock the resolution and multi-select semantics without requiring a GL context (stub + bound Scene.select).

Testing

  • PYTHONPATH=Libraries/PyKotor/src:Libraries/bioware-kaitai-formats/src QT_QPA_PLATFORM=offscreen python3 -m pytest --import-mode=importlib -m "not gui and not slow" --timeout=120 Libraries/PyKotor/tests/gl/test_camera_controller.py Libraries/PyKotor/tests/gl/test_scene_select.py
  • pyright on the two test files (0 issues).

Note: Scene() full construction compiles shaders and can fail headless; test_scene_select uses a minimal stub with _module is None so SceneCache.build_cache is a no-op, while still executing the real Scene.select implementation.

Checklist

  • My code follows the project's style guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
Open in Web View Automation 

cursoragent and others added 2 commits April 8, 2026 10:07
Co-authored-by: Boden <th3w1zard1@users.noreply.github.com>
Co-authored-by: Boden <th3w1zard1@users.noreply.github.com>
@github-actions github-actions Bot added size/M Medium PR (100-300 lines) python Pull requests that update python code libraries labels Apr 8, 2026
@oldrepublicwizard
oldrepublicwizard merged commit 48634e6 into master Apr 28, 2026
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries python Pull requests that update python code size/M Medium PR (100-300 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant