diff --git a/apitests/user32/CMakeLists.txt b/apitests/user32/CMakeLists.txt index d57524afd53..9b3f4acdbfd 100644 --- a/apitests/user32/CMakeLists.txt +++ b/apitests/user32/CMakeLists.txt @@ -14,6 +14,7 @@ list(APPEND SOURCE ScrollDC.c ScrollWindowEx.c SetCursorPos.c + SetActiveWindow.c WndProc.c testlist.c user32_apitest.rc) diff --git a/apitests/user32/SetActiveWindow.c b/apitests/user32/SetActiveWindow.c new file mode 100644 index 00000000000..3a5b6c1405b --- /dev/null +++ b/apitests/user32/SetActiveWindow.c @@ -0,0 +1,92 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for SetActiveWindow + * PROGRAMMERS: Giannis Adamopoulos + */ + +#include +#include +#include + + +#define EXPECT_NEXT(hWnd1, hWnd2) ok(GetWindow(hWnd1,GW_HWNDNEXT) == hWnd2, "Expected %p after %p, not %p\n",hWnd2,hWnd1,GetWindow(hWnd1,GW_HWNDNEXT) ) +#define EXPECT_ACTIVE(hwnd) ok(GetActiveWindow() == hwnd, "Expected %p to be the active window, not %p\n",hwnd,GetActiveWindow()) + +void Test_SetActiveWindow() +{ + MSG msg; + HWND hWnd1, hWnd2, hWnd3, hWnd4; + + hWnd1 = CreateWindowW(L"BUTTON", L"ownertest", WS_OVERLAPPEDWINDOW, + 20, 20, 300, 300, NULL, NULL, 0, NULL); + + hWnd2 = CreateWindowW(L"BUTTON", L"ownertest", WS_OVERLAPPEDWINDOW, + 20, 350, 300, 300, hWnd1, NULL, 0, NULL); + + hWnd3 = CreateWindowW(L"BUTTON", L"ownertest", WS_OVERLAPPEDWINDOW, + 200, 200, 300, 300, NULL, NULL, 0, NULL); + + hWnd4 = CreateWindowW(L"BUTTON", L"ownertest", WS_OVERLAPPEDWINDOW, + 250, 250, 200, 200, hWnd1, NULL, 0, NULL); + + ShowWindow(hWnd1, SW_SHOW); + UpdateWindow(hWnd1); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + EXPECT_NEXT(hWnd4,hWnd2); + EXPECT_NEXT(hWnd1,hWnd3); + + ShowWindow(hWnd2, SW_SHOW); + UpdateWindow(hWnd2); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + EXPECT_NEXT(hWnd2,hWnd4); + EXPECT_NEXT(hWnd4,hWnd1); + + ShowWindow(hWnd3, SW_SHOW); + UpdateWindow(hWnd3); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + EXPECT_NEXT(hWnd3,hWnd2); + EXPECT_NEXT(hWnd2,hWnd4); + EXPECT_NEXT(hWnd4,hWnd1); + + ShowWindow(hWnd4, SW_SHOW); + UpdateWindow(hWnd4); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + EXPECT_NEXT(hWnd4,hWnd2); + EXPECT_NEXT(hWnd2,hWnd1); + EXPECT_NEXT(hWnd1,hWnd3); + EXPECT_ACTIVE(hWnd4); + + SetActiveWindow(hWnd1); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + EXPECT_NEXT(hWnd4,hWnd2); + EXPECT_NEXT(hWnd2,hWnd1); + EXPECT_NEXT(hWnd1,hWnd3); + EXPECT_ACTIVE(hWnd1); + + SetActiveWindow(hWnd3); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + EXPECT_NEXT(hWnd3,hWnd4); + EXPECT_NEXT(hWnd4,hWnd2); + EXPECT_NEXT(hWnd2,hWnd1); + EXPECT_ACTIVE(hWnd3); + + SetActiveWindow(hWnd2); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + EXPECT_NEXT(hWnd2,hWnd4); + EXPECT_NEXT(hWnd4,hWnd1); + EXPECT_NEXT(hWnd1,hWnd3); + EXPECT_ACTIVE(hWnd2); +} + +START_TEST(SetActiveWindow) +{ + Test_SetActiveWindow(); +} diff --git a/apitests/user32/testlist.c b/apitests/user32/testlist.c index fe27138d10b..51c4fce8244 100644 --- a/apitests/user32/testlist.c +++ b/apitests/user32/testlist.c @@ -15,6 +15,7 @@ extern void func_GetPeekMessage(void); extern void func_DeferWindowPos(void); extern void func_GetKeyState(void); extern void func_SetCursorPos(void); +extern void func_SetActiveWindow(void); extern void func_WndProc(void); const struct test winetest_testlist[] = @@ -29,6 +30,7 @@ const struct test winetest_testlist[] = { "DeferWindowPos", func_DeferWindowPos }, { "GetKeyState", func_GetKeyState }, { "SetCursorPos", func_SetCursorPos }, + { "SetActiveWindow", func_SetActiveWindow }, { "WndProc", func_WndProc }, { 0, 0 } }; diff --git a/apitests/user32/user32_apitest.rbuild b/apitests/user32/user32_apitest.rbuild index fdd83b50d76..cae3019caa8 100644 --- a/apitests/user32/user32_apitest.rbuild +++ b/apitests/user32/user32_apitest.rbuild @@ -19,6 +19,7 @@ GetIconInfo.c GetPeekMessage.c DeferWindowPos.c + SetActiveWindow.c SetCursorPos.c WndProc.c diff --git a/tests/pseh2/CMakeLists.txt b/tests/pseh2/CMakeLists.txt index bf5ece119ad..53080208653 100644 --- a/tests/pseh2/CMakeLists.txt +++ b/tests/pseh2/CMakeLists.txt @@ -6,3 +6,7 @@ target_link_libraries(pseh2_test wine ${PSEH_LIB}) set_module_type(pseh2_test win32cui) add_importlibs(pseh2_test msvcrt kernel32 ntdll) add_cd_file(TARGET pseh2_test DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + allow_warnings(pseh2_test) +endif() diff --git a/winetests/comctl32/CMakeLists.txt b/winetests/comctl32/CMakeLists.txt index 78aa89973dc..34f36a2d0ab 100644 --- a/winetests/comctl32/CMakeLists.txt +++ b/winetests/comctl32/CMakeLists.txt @@ -39,6 +39,8 @@ target_link_libraries(comctl32_winetest wine) if(MSVC) target_link_libraries(comctl32_winetest uuid) +else() + allow_warnings(comctl32_winetest) endif() set_module_type(comctl32_winetest win32cui) diff --git a/winetests/fusion/CMakeLists.txt b/winetests/fusion/CMakeLists.txt index 7d0409d03cc..e265d5b2dbe 100644 --- a/winetests/fusion/CMakeLists.txt +++ b/winetests/fusion/CMakeLists.txt @@ -15,3 +15,7 @@ target_link_libraries(fusion_winetest wine) set_module_type(fusion_winetest win32cui) add_importlibs(fusion_winetest user32 msvcrt kernel32 ntdll) add_cd_file(TARGET fusion_winetest DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + allow_warnings(fusion_winetest) +endif() diff --git a/winetests/gdi32/CMakeLists.txt b/winetests/gdi32/CMakeLists.txt index 4d32dbabe7f..6259f6b2ae0 100644 --- a/winetests/gdi32/CMakeLists.txt +++ b/winetests/gdi32/CMakeLists.txt @@ -3,6 +3,8 @@ add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) +remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502) + list(APPEND SOURCE bitmap.c brush.c diff --git a/winetests/gdi32/metafile.c b/winetests/gdi32/metafile.c index 2a80b974a41..fe9638c4141 100755 --- a/winetests/gdi32/metafile.c +++ b/winetests/gdi32/metafile.c @@ -1427,14 +1427,15 @@ static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits, const ENHMETARECORD *emr1 = (const ENHMETARECORD *)(bits + offset1); const ENHMETARECORD *emr2 = (const ENHMETARECORD *)(buf + offset2); -#if 1 +if(!winetest_interactive) skip("skipping match_emf_record(), bug 5393\n"); -#else +else +{ trace("%s: EMF record %u, size %u/record %u, size %u\n", desc, emr1->iType, emr1->nSize, emr2->iType, emr2->nSize); if (!match_emf_record(emr1, emr2, desc, ignore_scaling)) return -1; -#endif +} /* We have already bailed out if iType or nSize don't match */ offset1 += emr1->nSize; diff --git a/winetests/kernel32/CMakeLists.txt b/winetests/kernel32/CMakeLists.txt index 30b0f22edf6..5a26ce15824 100644 --- a/winetests/kernel32/CMakeLists.txt +++ b/winetests/kernel32/CMakeLists.txt @@ -3,6 +3,8 @@ add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) +remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502) + set_rc_compiler() list(APPEND SOURCE @@ -48,5 +50,8 @@ add_executable(kernel32_winetest ${SOURCE}) target_link_libraries(kernel32_winetest wine) set_module_type(kernel32_winetest win32cui) add_importlibs(kernel32_winetest user32 advapi32 msvcrt kernel32 ntdll) +if(NOT MSVC) + allow_warnings(kernel32_winetest) +endif() add_cd_file(TARGET kernel32_winetest DESTINATION reactos/bin FOR all) \ No newline at end of file diff --git a/winetests/msvcrt/CMakeLists.txt b/winetests/msvcrt/CMakeLists.txt index f68840bd687..99163adac68 100644 --- a/winetests/msvcrt/CMakeLists.txt +++ b/winetests/msvcrt/CMakeLists.txt @@ -24,6 +24,8 @@ add_executable(msvcrt_winetest ${SOURCE}) if(MSVC) target_link_libraries(msvcrt_winetest oldnames) +else() + allow_warnings(msvcrt_winetest) endif() set_module_type(msvcrt_winetest win32cui) diff --git a/winetests/ntdll/CMakeLists.txt b/winetests/ntdll/CMakeLists.txt index 68c56bd557a..0fe16a31a38 100644 --- a/winetests/ntdll/CMakeLists.txt +++ b/winetests/ntdll/CMakeLists.txt @@ -29,3 +29,6 @@ add_executable(ntdll_winetest ${SOURCE}) set_module_type(ntdll_winetest win32cui) add_importlibs(ntdll_winetest user32 msvcrt kernel32 ntdll) add_cd_file(TARGET ntdll_winetest DESTINATION reactos/bin FOR all) +if(NOT MSVC) + allow_warnings(ntdll_winetest) +endif() diff --git a/winetests/powrprof/CMakeLists.txt b/winetests/powrprof/CMakeLists.txt index 1146223bcf7..3ae788bee91 100644 --- a/winetests/powrprof/CMakeLists.txt +++ b/winetests/powrprof/CMakeLists.txt @@ -8,3 +8,7 @@ add_executable(powrprof_winetest pwrprof.c testlist.c) set_module_type(powrprof_winetest win32cui) add_importlibs(powrprof_winetest advapi32 powrprof msvcrt kernel32 ntdll) add_cd_file(TARGET powrprof_winetest DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + allow_warnings(powrprof_winetest) +endif() diff --git a/winetests/rpcrt4/CMakeLists.txt b/winetests/rpcrt4/CMakeLists.txt index 75b418df0f9..ad9383bcde4 100644 --- a/winetests/rpcrt4/CMakeLists.txt +++ b/winetests/rpcrt4/CMakeLists.txt @@ -1,5 +1,6 @@ -remove_definitions(-D_WIN32_WINNT=0x502) +remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502) + add_definitions(-D_WIN32_WINNT=0x500) add_definitions( @@ -44,3 +45,7 @@ target_link_libraries(rpcrt4_winetest set_module_type(rpcrt4_winetest win32cui) add_importlibs(rpcrt4_winetest ole32 rpcrt4 msvcrt kernel32 ntdll) add_cd_file(TARGET rpcrt4_winetest DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + allow_warnings(rpcrt4_winetest) +endif() diff --git a/winetests/setupapi/CMakeLists.txt b/winetests/setupapi/CMakeLists.txt index ab220dd360b..65a5bd93dea 100644 --- a/winetests/setupapi/CMakeLists.txt +++ b/winetests/setupapi/CMakeLists.txt @@ -19,3 +19,7 @@ target_link_libraries(setupapi_winetest wine) set_module_type(setupapi_winetest win32cui) add_importlibs(setupapi_winetest advapi32 setupapi user32 msvcrt kernel32 ntdll) add_cd_file(TARGET setupapi_winetest DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + allow_warnings(setupapi_winetest) +endif() diff --git a/winetests/shdocvw/CMakeLists.txt b/winetests/shdocvw/CMakeLists.txt index d4ec5befe4f..5bf15d81a79 100644 --- a/winetests/shdocvw/CMakeLists.txt +++ b/winetests/shdocvw/CMakeLists.txt @@ -15,3 +15,7 @@ target_link_libraries(shdocvw_winetest wine uuid) set_module_type(shdocvw_winetest win32cui) add_importlibs(shdocvw_winetest gdi32 shell32 ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET shdocvw_winetest DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + allow_warnings(shdocvw_winetest) +endif() diff --git a/winetests/urlmon/CMakeLists.txt b/winetests/urlmon/CMakeLists.txt index aad867fbca6..609a9aae811 100644 --- a/winetests/urlmon/CMakeLists.txt +++ b/winetests/urlmon/CMakeLists.txt @@ -1,4 +1,6 @@ +remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502) + add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) diff --git a/winetests/user32/CMakeLists.txt b/winetests/user32/CMakeLists.txt index c1a45e01809..3c251c1d3aa 100644 --- a/winetests/user32/CMakeLists.txt +++ b/winetests/user32/CMakeLists.txt @@ -38,3 +38,7 @@ target_link_libraries(user32_winetest wine) set_module_type(user32_winetest win32cui) add_importlibs(user32_winetest user32 gdi32 advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET user32_winetest DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + allow_warnings(user32_winetest) +endif() \ No newline at end of file diff --git a/winetests/wininet/CMakeLists.txt b/winetests/wininet/CMakeLists.txt index e3a01707794..0717420123a 100644 --- a/winetests/wininet/CMakeLists.txt +++ b/winetests/wininet/CMakeLists.txt @@ -1,4 +1,6 @@ +remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502) + add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) diff --git a/winetests/winmm/CMakeLists.txt b/winetests/winmm/CMakeLists.txt index 4d24b9aa029..521c9609832 100644 --- a/winetests/winmm/CMakeLists.txt +++ b/winetests/winmm/CMakeLists.txt @@ -17,3 +17,7 @@ target_link_libraries(winmm_winetest wine dxguid) set_module_type(winmm_winetest win32cui) add_importlibs(winmm_winetest winmm user32 msvcrt kernel32 ntdll) add_cd_file(TARGET winmm_winetest DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + allow_warnings(winmm_winetest) +endif() diff --git a/winetests/ws2_32/CMakeLists.txt b/winetests/ws2_32/CMakeLists.txt index 1001f21dca9..ec813611c09 100644 --- a/winetests/ws2_32/CMakeLists.txt +++ b/winetests/ws2_32/CMakeLists.txt @@ -8,3 +8,7 @@ target_link_libraries(ws2_32_winetest wine) set_module_type(ws2_32_winetest win32cui) add_importlibs(ws2_32_winetest ws2_32 user32 msvcrt kernel32 ntdll) add_cd_file(TARGET ws2_32_winetest DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + allow_warnings(ws2_32_winetest) +endif()