Author: tfaber Date: Mon Apr 6 06:34:04 2015 New Revision: 67070 URL: http://svn.reactos.org/svn/reactos?rev=67070&view=rev Log: [USER32_APITEST] - Rename CreateWindowEx test to SetParent since that's what it tests
Added: trunk/rostests/apitests/user32/SetParent.c - copied, changed from r67058, trunk/rostests/apitests/user32/CreateWindowEx.c Removed: trunk/rostests/apitests/user32/CreateWindowEx.c Modified: trunk/rostests/apitests/user32/CMakeLists.txt trunk/rostests/apitests/user32/testlist.c Modified: trunk/rostests/apitests/user32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CMakeLists.txt?rev=67070&r1=67069&r2=67070&view=diff ============================================================================== --- trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] Mon Apr 6 06:34:04 2015 @@ -3,7 +3,6 @@ AttachThreadInput.c helper.c CreateIconFromResourceEx.c - CreateWindowEx.c DeferWindowPos.c DestroyCursorIcon.c DrawIconEx.c @@ -24,6 +23,7 @@ SendMessageTimeout.c SetActiveWindow.c SetCursorPos.c + SetParent.c SystemParametersInfo.c TrackMouseEvent.c WndProc.c Removed: trunk/rostests/apitests/user32/CreateWindowEx.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CreateWindowEx.c?rev=67069 ============================================================================== --- trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/CreateWindowEx.c (removed) @@ -1,189 +0,0 @@ -/* - * PROJECT: ReactOS API tests - * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory - * PURPOSE: Test for CreateWindow stuff - * PROGRAMMERS: Thomas Faber <thomas.fa...@reactos.org> - */ - -#include <apitest.h> - -#include <winuser.h> -#include "helper.h" - -static HWND hWndList[5 + 1]; -static const int hWndCount = sizeof(hWndList) / sizeof(hWndList[0]) - 1; -static DWORD dwThreadId; - -#define ok_hwnd(val, exp) do \ - { \ - HWND _val = (val), _exp = (exp); \ - int _ival = get_iwnd(_val, FALSE); \ - int _iexp = get_iwnd(_exp, FALSE); \ - ok(_val == _exp, #val " = %p (%d), expected %p (%d)\n", _val, _ival, _exp, _iexp); \ - } while (0) - -static -int -get_iwnd( - _In_ HWND hWnd, - _In_ BOOL set) -{ - int i; - if (!hWnd) - return 0; - for (i = 1; i <= hWndCount; i++) - { - if (hWndList[i] == hWnd) - return i; - } - if (!set) - return 0; - for (i = 1; i <= hWndCount; i++) - { - if (hWndList[i] == NULL) - { - hWndList[i] = hWnd; - return i; - } - } - ok(0, "Too many windows!\n"); - return 0; -} - -static -BOOL -CALLBACK -EnumProc( - _In_ HWND hWnd, - _In_ LPARAM lParam) -{ - HWND hLookingFor = (HWND)lParam; - return hWnd != hLookingFor; -} - -static -LRESULT -CALLBACK -WndProc( - _In_ HWND hWnd, - _In_ UINT message, - _In_ WPARAM wParam, - _In_ LPARAM lParam) -{ - HWND hTest; - int iwnd = get_iwnd(hWnd, TRUE); - - ok(GetCurrentThreadId() == dwThreadId, "Thread 0x%lx instead of 0x%lx\n", GetCurrentThreadId(), dwThreadId); - if (message > WM_USER || IsDWmMsg(message) || IseKeyMsg(message)) - return DefWindowProcW(hWnd, message, wParam, lParam); - - RECOND_MESSAGE(iwnd, message, SENT, wParam, lParam); - - switch(message) - { - case WM_DESTROY: - if (GetParent(hWnd)) - { - /* child window */ - ok(EnumThreadWindows(dwThreadId, EnumProc, (LPARAM)hWnd), "Child window %p (%d) enumerated\n", hWnd, iwnd); - ok(!EnumChildWindows(GetParent(hWnd), EnumProc, (LPARAM)hWnd), "Child window %p (%d) not enumerated\n", hWnd, iwnd); - ok(!EnumThreadWindows(dwThreadId, EnumProc, (LPARAM)GetParent(hWnd)), "Parent window of %p (%d) not enumerated\n", hWnd, iwnd); - } - else - { - /* top-level window */ - ok(!EnumThreadWindows(dwThreadId, EnumProc, (LPARAM)hWnd), "Window %p (%d) not enumerated in WM_DESTROY\n", hWnd, iwnd); - } - if (hWnd == hWndList[3]) - { - hTest = SetParent(hWndList[4], hWndList[2]); - ok_hwnd(hTest, hWndList[1]); - hTest = SetParent(hWndList[5], hWndList[1]); - ok_hwnd(hTest, hWndList[2]); - - ok_hwnd(GetParent(hWndList[1]), NULL); - ok_hwnd(GetParent(hWndList[2]), NULL); - ok_hwnd(GetParent(hWndList[3]), hWndList[1]); - ok_hwnd(GetParent(hWndList[4]), hWndList[2]); - ok_hwnd(GetParent(hWndList[5]), hWndList[1]); - } - break; - } - - return DefWindowProcW(hWnd, message, wParam, lParam); -} - - -START_TEST(CreateWindowEx) -{ - HWND hWnd; - MSG msg; - - SetCursorPos(0,0); - - dwThreadId = GetCurrentThreadId(); - hWndList[0] = INVALID_HANDLE_VALUE; - RegisterSimpleClass(WndProc, L"CreateTest"); - - hWnd = CreateWindowExW(0, L"CreateTest", NULL, 0, 10, 10, 20, 20, NULL, NULL, 0, NULL); - ok(hWnd != NULL, "CreateWindow failed\n"); - ok(hWnd == hWndList[1], "Got %p, expected %p\n", hWnd, hWndList[1]); - - hWnd = CreateWindowExW(0, L"CreateTest", NULL, 0, 40, 10, 20, 20, NULL, NULL, 0, NULL); - ok(hWnd != NULL, "CreateWindow failed\n"); - ok(hWnd == hWndList[2], "Got %p, expected %p\n", hWnd, hWndList[2]); - - hWnd = CreateWindowExW(0, L"CreateTest", NULL, WS_CHILD, 60, 10, 20, 20, hWndList[1], NULL, 0, NULL); - ok(hWnd != NULL, "CreateWindow failed\n"); - ok(hWnd == hWndList[3], "Got %p, expected %p\n", hWnd, hWndList[3]); - - hWnd = CreateWindowExW(0, L"CreateTest", NULL, WS_CHILD, 80, 10, 20, 20, hWndList[1], NULL, 0, NULL); - ok(hWnd != NULL, "CreateWindow failed\n"); - ok(hWnd == hWndList[4], "Got %p, expected %p\n", hWnd, hWndList[4]); - - hWnd = CreateWindowExW(0, L"CreateTest", NULL, WS_CHILD, 60, 10, 20, 20, hWndList[2], NULL, 0, NULL); - ok(hWnd != NULL, "CreateWindow failed\n"); - ok(hWnd == hWndList[5], "Got %p, expected %p\n", hWnd, hWndList[5]); - -trace("\n"); - while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) - { - int iwnd = get_iwnd(msg.hwnd, FALSE); - if(!(msg.message > WM_USER || IsDWmMsg(msg.message) || IseKeyMsg(msg.message))) - RECOND_MESSAGE(iwnd, msg.message, POST, 0, 0); - DispatchMessageA( &msg ); - } -trace("\n"); - TRACE_CACHE(); -trace("\n"); - - ok_hwnd(GetParent(hWndList[1]), NULL); - ok_hwnd(GetParent(hWndList[2]), NULL); - ok_hwnd(GetParent(hWndList[3]), hWndList[1]); - ok_hwnd(GetParent(hWndList[4]), hWndList[1]); - ok_hwnd(GetParent(hWndList[5]), hWndList[2]); - - DestroyWindow(hWndList[1]); - ok(!IsWindow(hWndList[1]), "\n"); - ok( IsWindow(hWndList[2]), "\n"); - ok(!IsWindow(hWndList[3]), "\n"); - ok( IsWindow(hWndList[4]), "\n"); - ok(!IsWindow(hWndList[5]), "\n"); - - ok_hwnd(GetParent(hWndList[1]), NULL); - ok_hwnd(GetParent(hWndList[2]), NULL); - ok_hwnd(GetParent(hWndList[3]), NULL); - ok_hwnd(GetParent(hWndList[4]), hWndList[2]); - ok_hwnd(GetParent(hWndList[5]), NULL); - -trace("\n"); - while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) - { - int iwnd = get_iwnd(msg.hwnd, FALSE); - if(!(msg.message > WM_USER || IsDWmMsg(msg.message) || IseKeyMsg(msg.message))) - RECOND_MESSAGE(iwnd, msg.message, POST, 0, 0); - DispatchMessageA( &msg ); - } -trace("\n"); - TRACE_CACHE(); - } Copied: trunk/rostests/apitests/user32/SetParent.c (from r67058, trunk/rostests/apitests/user32/CreateWindowEx.c) URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/SetParent.c?p2=trunk/rostests/apitests/user32/SetParent.c&p1=trunk/rostests/apitests/user32/CreateWindowEx.c&r1=67058&r2=67070&rev=67070&view=diff ============================================================================== --- trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/SetParent.c [iso-8859-1] Mon Apr 6 06:34:04 2015 @@ -1,7 +1,7 @@ /* * PROJECT: ReactOS API tests * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory - * PURPOSE: Test for CreateWindow stuff + * PURPOSE: Test for SetParent * PROGRAMMERS: Thomas Faber <thomas.fa...@reactos.org> */ @@ -114,7 +114,7 @@ } -START_TEST(CreateWindowEx) +START_TEST(SetParent) { HWND hWnd; MSG msg; Modified: trunk/rostests/apitests/user32/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/testlist.c?rev=67070&r1=67069&r2=67070&view=diff ============================================================================== --- trunk/rostests/apitests/user32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/testlist.c [iso-8859-1] Mon Apr 6 06:34:04 2015 @@ -5,7 +5,6 @@ extern void func_AttachThreadInput(void); extern void func_CreateIconFromResourceEx(void); -extern void func_CreateWindowEx(void); extern void func_DeferWindowPos(void); extern void func_DestroyCursorIcon(void); extern void func_DrawIconEx(void); @@ -26,6 +25,7 @@ extern void func_SendMessageTimeout(void); extern void func_SetActiveWindow(void); extern void func_SetCursorPos(void); +extern void func_SetParent(void); extern void func_SystemParametersInfo(void); extern void func_TrackMouseEvent(void); extern void func_WndProc(void); @@ -35,7 +35,6 @@ { { "AttachThreadInput", func_AttachThreadInput }, { "CreateIconFromResourceEx", func_CreateIconFromResourceEx }, - { "CreateWindowEx", func_CreateWindowEx }, { "DeferWindowPos", func_DeferWindowPos }, { "DestroyCursorIcon", func_DestroyCursorIcon }, { "DrawIconEx", func_DrawIconEx }, @@ -56,6 +55,7 @@ { "SendMessageTimeout", func_SendMessageTimeout }, { "SetActiveWindow", func_SetActiveWindow }, { "SetCursorPos", func_SetCursorPos }, + { "SetParent", func_SetParent }, { "SystemParametersInfo", func_SystemParametersInfo }, { "TrackMouseEvent", func_TrackMouseEvent }, { "WndProc", func_WndProc },