Introduce new Lua APIs to query animation status and progress#337
Open
jbms wants to merge 1 commit into
Open
Conversation
Owner
|
No, I don't want people to control the compositor from Lua. The idea of Lua is to write simple scripts, not provide a framework to run tests on the compositor. Also, I don't want the test suite to become an ends in itself, and we are slowly getting there. More often than not, tests are good, but they quickly become obsolete when a bug is fixed, and regressions are not even easy to find using the old tests because they usually happen because of new code, so in the end you have a huge test suite where finding things is hard, and it only proves lots of old bugs were fixed. I prefer to document the issues and explain why they happened than to have a myriad of tests that only prove a bug was fixed. |
7378f00 to
435a2b4
Compare
Introduce new Lua APIs to query animation status and progress. Also includes testing infrastructure and tests: - Added `tests/test_leak_two_clients.py` to check for runtime leaks with clients active. - Added `tests/test_shutdown_events.py` and `tests/test_shutdown_lua_callbacks.py` to verify shutdown behavior and Lua callbacks. - Added `test_normal_exit_with_bar` to `tests/test_normal_exit.py` to ensure `scrollbar` is covered by LSan checks during normal shutdown.
435a2b4 to
af3dfa2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the following Lua APIs:
scroll.animation_get_duration(): Returns the duration of the current animation in milliseconds.scroll.animation_get_elapsed_time(): Returns the elapsed time of the current animation in milliseconds, taking manual stepping into account.These APIs allow tests to verify animation geometry and progress without relying on real-time delays.
This also updates the Python tests to run faster and more robustly.
Disable animations by default in the test compositor configuration to avoid unnecessary transaction delays. Tests that explicitly require animations (e.g. animation offset or workspace animation tests) use custom fixtures that enable and configure animations.
Refactor existing integration tests to eliminate
time.sleep:tests/test_geometry.py: Rewritetest_animating_geometryto use manual stepping and the new animation time APIs.tests/test_normal_exit.py: Usesubprocess.Popen.waitinstead of a manual polling loop.tests/test_workspace_split_uaf.py: Use the shared compositor (since animations are now disabled by default).wait_for_idleorwait_for_client_mapto wait for transactions to settle.Add a new test
tests/test_animation_offset.pyto verify the new animation time APIs under both normal and manual stepping modes.Implement a thorough reset mechanism for the session-scoped
scroll_compositorfixture:ScrollInstance.reset()after each test.reset()useskill allto close all views, unplugs extra outputs, reloads the sway configuration to reset defaults (which also recreates the Lua state and discards registered callbacks), and recreates the default workspace 1 to reset its layout modifiers.Optimize test suite execution speed:
pytest-xdistto the Nix development shell.pytest.inito run tests in parallel with 4 workers by default (-n 4), which is stable under ASan and avoids OOM/thrashing.-Dbuildtype=debugoptimizedfor-O2) when building the compositor for tests under ASan.