kernel32/tests: Use current console input in test_ReadConsole.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-10-14 19:57:37 +02:00 committed by Alexandre Julliard
parent 70c1d4fcaa
commit 1668db80ab
1 changed files with 6 additions and 14 deletions

View File

@ -2977,21 +2977,13 @@ static void test_ReadConsoleOutput(HANDLE console)
ok(ch == 'z', "unexpected char %c/%x\n", ch, ch);
}
static void test_ReadConsole(void)
static void test_ReadConsole(HANDLE input)
{
HANDLE std_input;
DWORD ret, bytes;
char buf[1024];
std_input = GetStdHandle(STD_INPUT_HANDLE);
SetLastError(0xdeadbeef);
ret = GetFileSize(std_input, NULL);
if (GetLastError() == 0xdeadbeef)
{
skip("stdin is redirected\n");
return;
}
ret = GetFileSize(input, NULL);
ok(ret == INVALID_FILE_SIZE, "expected INVALID_FILE_SIZE, got %#x\n", ret);
ok(GetLastError() == ERROR_INVALID_HANDLE ||
GetLastError() == ERROR_INVALID_FUNCTION, /* Win 8, 10 */
@ -2999,7 +2991,7 @@ static void test_ReadConsole(void)
bytes = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = ReadFile(std_input, buf, -128, &bytes, NULL);
ret = ReadFile(input, buf, -128, &bytes, NULL);
ok(!ret, "expected 0, got %u\n", ret);
ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
GetLastError() == ERROR_NOACCESS, /* Win 8, 10 */
@ -3008,7 +3000,7 @@ static void test_ReadConsole(void)
bytes = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = ReadConsoleA(std_input, buf, -128, &bytes, NULL);
ret = ReadConsoleA(input, buf, -128, &bytes, NULL);
ok(!ret, "expected 0, got %u\n", ret);
ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
GetLastError() == ERROR_NOACCESS, /* Win 8, 10 */
@ -3017,7 +3009,7 @@ static void test_ReadConsole(void)
bytes = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = ReadConsoleW(std_input, buf, -128, &bytes, NULL);
ret = ReadConsoleW(input, buf, -128, &bytes, NULL);
ok(!ret, "expected 0, got %u\n", ret);
ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
GetLastError() == ERROR_NOACCESS, /* Win 8, 10 */
@ -4213,7 +4205,7 @@ START_TEST(console)
ok(sbi.dwSize.Y == size, "Unexpected buffer size: %d instead of %d\n", sbi.dwSize.Y, size);
if (!ret) return;
test_ReadConsole();
test_ReadConsole(hConIn);
/* Non interactive tests */
testCursor(hConOut, sbi.dwSize);
/* test parameters (FIXME: test functionality) */