From 4d3eb56e7cd53f8f6df7717e2b1274691f0ebd70 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Thu, 20 Apr 2023 14:24:39 +0200 Subject: [PATCH] kernel32/tests: Fix the ScrollConsoleScreenBuffer() tests on Windows 10 1909. On Windows 10 1909 ScrollConsoleScreenBufferA() returns an error if the destination is not within the clip rectangle but still modifies the console buffer as expected! So mark this behavior as very_broken(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54871 --- dlls/kernel32/tests/console.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index c2a8e99458f..5adce2d3f37 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -683,6 +683,20 @@ static void testScroll(HANDLE hCon, COORD sbSize) "Expected ERROR_NOT_ENOUGH_MEMORY, got %lu\n", GetLastError()); } + /* no clipping, src & dst rect do overlap */ + scroll.Left = 0; + scroll.Right = W - 1; + scroll.Top = 0; + scroll.Bottom = H - 1; + dst.X = W / 2 - 3; + dst.Y = H / 2 - 3; + ci.Char.UnicodeChar = '#'; + ci.Attributes = TEST_ATTRIB; + + ret = ScrollConsoleScreenBufferA(hCon, &scroll, NULL, dst, &ci); + ok(ret, "ScrollConsoleScreenBufferA failed: %lu\n", GetLastError()); + /* no win10 1909 error here, only check the result of the clipped case */ + /* clipping, src & dst rect do overlap */ resetContent(hCon, sbSize, TRUE); @@ -700,8 +714,14 @@ static void testScroll(HANDLE hCon, COORD sbSize) clip.Top = H / 2; clip.Bottom = min(H + H / 2, sbSize.Y - 1); + /* Windows 10 1909 fails if the destination is not in the clip rect + * but the result is still ok! + */ + SetLastError(0xdeadbeef); ret = ScrollConsoleScreenBufferA(hCon, &scroll, &clip, dst, &ci); - ok(ret, "ScrollConsoleScreenBufferA failed: %lu\n", GetLastError()); + ok((ret && GetLastError() == 0xdeadbeef) || + broken(!ret && GetLastError() == ERROR_INVALID_PARAMETER), + "ScrollConsoleScreenBufferA failed: %lu\n", GetLastError()); for (c.Y = 0; c.Y < sbSize.Y; c.Y++) {