conhost: Fix tests on ReadConsole with CONSOLE_READCONSOLE_CONTROL.

It should fix the errors around line 1370 in conhost/tests/tty.c, but
it doesn't fix other errors around line 1530 and 1550 which are
completly unrelated to this change.  So failures to be expected on the
latter.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52648
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
This commit is contained in:
Eric Pouech 2022-10-08 17:44:54 +02:00 committed by Alexandre Julliard
parent 627f2b3557
commit c19f3b620a

View file

@ -1337,6 +1337,9 @@ static void test_read_console_control(void)
/* test simple behavior */
for (ctrl = 0; ctrl < ' '; ctrl++)
{
DWORD state;
SHORT cc;
/* don't play with fire */
if (ctrl == 0 || ctrl == 3 || ctrl == '\n' || ctrl == 27) continue;
@ -1359,10 +1362,13 @@ static void test_read_console_control(void)
strcpy(buf, "def."); buf[3] = ctrl;
write_console_pipe(buf);
wcscpy(bufw, L"abcdef."); bufw[6] = (WCHAR)ctrl;
child_expect_read_control_result(child_pipe, bufw,
(ctrl == '\t' || ctrl == '\r') ? 0
: ((ctrl == 30 || ctrl == 31) ? (LEFT_CTRL_PRESSED | SHIFT_PRESSED)
: LEFT_CTRL_PRESSED));
/* ^H requires special handling */
cc = (ctrl == 8) ? 0x0200 : VkKeyScanA(ctrl);
if (cc == -1) cc = 0;
state = 0;
if (cc & 0x0100) state |= SHIFT_PRESSED;
if (cc & 0x0200) state |= LEFT_CTRL_PRESSED;
child_expect_read_control_result(child_pipe, bufw, state);
skip_sequence("\x1b[?25l"); /* hide cursor */
expect_output_sequence("def");
skip_sequence("\x1b[?25h"); /* show cursor */