Skip to content

tests: don't assume the virtual screen starts at 0,0 on Windows - #613

Merged
BoboTiG merged 1 commit into
BoboTiG:mainfrom
jeanluyac-sketch:fix-tests-negative-virtual-origin
Dec 1, 2026
Merged

BoboTiG merged 1 commit into
BoboTiG:mainfrom
jeanluyac-sketch:fix-tests-negative-virtual-origin

Conversation

@jeanluyac-sketch

@jeanluyac-sketch jeanluyac-sketch commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #612.

Two tests fail on Windows machines where a monitor sits left of (or above) the primary one, independently of any code change:

  • test_implementation.py::TestEntryPoint::test_coordinates_capture expects sct-2x12_40x67.png, but CLI coordinates are relative to monitor 0 (the virtual screen), whose origin is negative there. With a monitor at left=-1366 the file is sct-2x-1354_40x67.png. The expected name is now computed from monitors[0].

  • test_save.py::test_callback renames mon0.png to mon0.png.old; on Windows Path.rename() raises FileExistsError if the target exists. It now uses Path.replace().

  • Tests added/updated: tests only, no runtime change

  • Documentation updated (or your review concluded: not needed)

  • Release notes added (or your review concluded: not needed)

  • ./check.sh (or ./check.ps1) passed

Tested on Windows 11 / Python 3.14 with four monitors (one at -1366,0): full suite 169 passed, 31 skipped, 0 failed (5 failed before this change). The affected tests also pass on Linux.

AI assistance disclosure

  • AI was partially used to create this change: the patch and this description were drafted with Claude; I reviewed them and ran the suite on my machine.

test_coordinates_capture expected sct-2x12_40x67.png, but CLI coordinates
are relative to monitor 0, whose origin is negative when a monitor sits
left of or above the primary one (e.g. left=-1366 gives sct-2x-1354_...).
test_callback renamed mon0.png to an existing .old file, which raises
FileExistsError on Windows; use Path.replace().

AI-assisted (Claude): drafted with AI, reviewed and run by the author.
@BoboTiG
BoboTiG merged commit 6a3385d into BoboTiG:main Dec 1, 2026
17 of 21 checks passed
@BoboTiG

BoboTiG commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Thanks @jeanluyac-sketch !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants