From: Jinoh Kang jinoh.kang.kr@gmail.com
--- dlls/kernel32/tests/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 2904a31d014..364d0ae2561 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -545,8 +545,8 @@ static void doChild(const char* file, const char* option) ok( ret, "Setting mode (%ld)\n", GetLastError()); ret = SetConsoleMode(hConOut, modeOut ^ 1); ok( ret, "Setting mode (%ld)\n", GetLastError()); - sbi.dwCursorPosition.X ^= 1; - sbi.dwCursorPosition.Y ^= 1; + sbi.dwCursorPosition.X = (sbi.dwCursorPosition.X ^ 1) % sbi.dwSize.X; + sbi.dwCursorPosition.Y = (sbi.dwCursorPosition.Y ^ 1) % sbi.dwSize.Y; ret = SetConsoleCursorPosition(hConOut, sbi.dwCursorPosition); ok( ret, "Setting cursor position (%ld)\n", GetLastError()); }
eric pouech (@epo) commented about dlls/kernel32/tests/process.c:
ok( ret, "Setting mode (%ld)\n", GetLastError()); ret = SetConsoleMode(hConOut, modeOut ^ 1); ok( ret, "Setting mode (%ld)\n", GetLastError());
sbi.dwCursorPosition.X ^= 1;
sbi.dwCursorPosition.Y ^= 1;
sbi.dwCursorPosition.X = (sbi.dwCursorPosition.X ^ 1) % sbi.dwSize.X;
sbi.dwCursorPosition.Y = (sbi.dwCursorPosition.Y ^ 1) % sbi.dwSize.Y;
afaict, there's no explicit check to avoid 0 sized screen buffers in either dimension (right click inside a console let you change window&sb size to eg. (0,1)) so I'm not 100% confident that the modular operation will not yield a division by zero exception
perhaps something like (untested) ``` sbi.dwCursorPosition.X = !sbi.dwCursorPosition.X; ``` would be sufficient (the test only checks in parent that it gets same position as the one set by child)
0 sized screen buffers in either dimension
In this case, `SetConsoleCursorPosition` will alwaya fail since even `(0, 0)` is out of bounds.
Maybe just skip this test?
On Tue Feb 20 14:40:17 2024 +0000, Jinoh Kang wrote:
0 sized screen buffers in either dimension
In this case, `SetConsoleCursorPosition` will alwaya fail since even `(0, 0)` is out of bounds. Maybe just skip this test?
Actually I don't think this is a problem. If size is 0 (either dim), the test already fails w/o this patch. The modulo just turns test failure into a div exception.