OpenAdapt
OpenAdapt copied to clipboard
feat: Enhance take_screenshot for multi-monitor support
Fixes #766 /claim #766
What kind of change does this PR introduce?
Feature
Summary
This PR introduces support for multi-monitor setups in the take_screenshot
function. It includes the following changes:
- Implemented
get_current_monitor
to determine the monitor where the cursor is currently located. - Modified
take_screenshot
to useget_current_monitor
for capturing the correct monitor. - Added comprehensive tests for
take_screenshot
with multiple monitors. - Mocked
get_current_monitor
andmss.mss
in tests to simulate multiple monitor configurations. - Ensured
take_screenshot
correctly handles multiple monitors and returns the expected screenshot.
Checklist
- [x] My code follows the style guidelines of OpenAdapt
- [x] I have performed a self-review of my code
- [x] If applicable, I have added tests to prove my fix is functional/effective
- [x] I have linted my code locally prior to submission
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation (e.g. README.md, requirements.txt)
- [x] New and existing unit tests pass locally with my changes
How can your code be run and tested?
To run and test the code:
- Ensure you have the necessary dependencies installed.
- Run the test suite using
pytest
:
pytest tests/openadapt/test_monitors.py
- Verify that all tests pass, including the new tests for multi-monitor support.
Other information
No additional context needed.