[WIN32KNT_APITEST] Strengthen NtUserGetThreadState testcase (#4291)

Add some paramters to test on. CORE-17732
This commit is contained in:
Katayama Hirofumi MZ 2022-01-17 16:01:31 +09:00 committed by GitHub
parent f1ad6845a8
commit 4bec8ff63e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
* PROJECT: ReactOS api tests
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
* PURPOSE: Test for NtUserGetThreadState
* COPYRIGHT: Copyright 2021 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
* COPYRIGHT: Copyright 2021-2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#include <win32nt.h>
@ -73,6 +73,9 @@ static VOID DoTest_EDIT(VOID)
{
HWND hWnd, hImeWnd;
HIMC hIMC;
HCURSOR hCursor;
LPARAM ExtraInfo;
LONG MsgTime;
hWnd = CreateWindowA("EDIT", "Test", ES_LEFT | ES_MULTILINE | WS_VISIBLE,
0, 0, 50, 30,
@ -83,6 +86,9 @@ static VOID DoTest_EDIT(VOID)
hIMC = ImmGetContext(hWnd);
ok_int(hIMC != NULL, TRUE);
ok_int(hIMC == (HIMC)NtUserGetThreadState(4), TRUE);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -92,8 +98,14 @@ static VOID DoTest_EDIT(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
SetCapture(hWnd);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -103,8 +115,14 @@ static VOID DoTest_EDIT(VOID)
DO_CHECK(2, hWnd);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
ReleaseCapture();
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -114,8 +132,14 @@ static VOID DoTest_EDIT(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
SetFocus(hWnd);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -125,8 +149,14 @@ static VOID DoTest_EDIT(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
SetActiveWindow(hWnd);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -136,8 +166,14 @@ static VOID DoTest_EDIT(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
SetActiveWindow(NULL);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -147,6 +183,9 @@ static VOID DoTest_EDIT(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
ImmReleaseContext(hWnd, hIMC);
DestroyWindow(hWnd);
@ -156,6 +195,9 @@ static VOID DoTest_BUTTON(VOID)
{
HWND hWnd, hImeWnd;
HIMC hIMC;
HCURSOR hCursor;
LPARAM ExtraInfo;
LONG MsgTime;
hWnd = CreateWindowA("BUTTON", "Test", BS_PUSHBUTTON | WS_VISIBLE,
0, 0, 50, 30,
@ -168,6 +210,9 @@ static VOID DoTest_BUTTON(VOID)
hIMC = (HIMC)NtUserGetThreadState(4);
ok_int(hIMC != NULL, TRUE);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -177,8 +222,14 @@ static VOID DoTest_BUTTON(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
SetCapture(hWnd);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -188,8 +239,14 @@ static VOID DoTest_BUTTON(VOID)
DO_CHECK(2, hWnd);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
ReleaseCapture();
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -199,8 +256,14 @@ static VOID DoTest_BUTTON(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
SetFocus(hWnd);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -210,8 +273,14 @@ static VOID DoTest_BUTTON(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
SetActiveWindow(hWnd);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -221,8 +290,14 @@ static VOID DoTest_BUTTON(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
SetActiveWindow(NULL);
hCursor = GetCursor();
ExtraInfo = GetMessageExtraInfo();
MsgTime = GetMessageTime();
#ifdef DO_PRINT
PrintThreadState(__LINE__, hWnd);
@ -232,6 +307,9 @@ static VOID DoTest_BUTTON(VOID)
DO_CHECK(2, 0);
DO_CHECK(3, hImeWnd);
DO_CHECK(4, hIMC);
DO_CHECK(6, hCursor);
DO_CHECK(8, ExtraInfo);
DO_CHECK(10, MsgTime);
DestroyWindow(hWnd);
}