From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user32/tests/monitor.c | 6 ++++ dlls/user32/tests/msg.c | 6 ++++ dlls/user32/tests/user32_test.h | 57 +++++++++++++++++++++++++++++++++ dlls/user32/tests/win.c | 7 ++++ 4 files changed, 76 insertions(+) create mode 100644 dlls/user32/tests/user32_test.h
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index 1dff85b9621..19b4efd827a 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -37,6 +37,8 @@ #include "wine/heap.h" #include <stdio.h>
+#include "user32_test.h" + DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_GPU_LUID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 1); DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_OUTPUT_ID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 2);
@@ -2214,6 +2216,7 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_ dm->dmDisplayFrequency, value);
value = GetDeviceCaps(hdc, BITSPIXEL); + todo_wine_if(is_driver( L"null" ) && dm->dmBitsPerPel == 16) ok_(__FILE__, line)(value == dm->dmBitsPerPel, "Expected BITSPIXEL %ld, got %d.\n", dm->dmBitsPerPel, value);
@@ -2366,6 +2369,7 @@ static void test_display_dc(void) if (res == DISP_CHANGE_SUCCESSFUL) { value = GetDeviceCaps(hdc, BITSPIXEL); + todo_wine_if(is_driver( L"null" ) && bpps[i] == 16) ok(value == (bpps[i] == 4 ? 1 : bpps[i]), "Expected %d, got %d.\n", (bpps[i] == 4 ? 1 : bpps[i]), value);
@@ -2430,10 +2434,12 @@ static void test_display_dc(void) * into the new compatible DC */ mem_dc = CreateCompatibleDC(hdc); bpp = GetDeviceCaps(mem_dc, BITSPIXEL); + todo_wine_if(is_driver( L"null" )) ok(bpp == dm2.dmBitsPerPel, "Expected bpp %ld, got %d.\n", dm2.dmBitsPerPel, bpp); old_hbitmap = SelectObject(mem_dc, hbitmap); ok(!!old_hbitmap, "Failed to select bitmap.\n"); bpp = GetDeviceCaps(mem_dc, BITSPIXEL); + todo_wine_if(is_driver( L"null" )) ok(bpp == dm2.dmBitsPerPel, "Expected bpp %ld, got %d.\n", dm2.dmBitsPerPel, bpp); SelectObject(mem_dc, old_hbitmap); DeleteDC(mem_dc); diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 35e4f0dd1f8..3f892c0bc91 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -36,6 +36,8 @@
#include "wine/test.h"
+#include "user32_test.h" + #define MDI_FIRST_CHILD_ID 2004
/* undocumented SWP flags - from SDK 3.1 */ @@ -12763,9 +12765,11 @@ static DWORD WINAPI test_edit_ime_messages(void *unused_arg)
himc = ImmGetContext(hwnd); ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmSetCompositionStringA failed.\n"); flush_sequence(); ret = ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmNotifyIME failed.\n"); /* Note that the following message loop is necessary to get the WM_CHAR messages because they * are posted. Same for the later message loops in this function. */ @@ -12785,9 +12789,11 @@ static DWORD WINAPI test_edit_ime_messages(void *unused_arg) ok(lr == EIMES_GETCOMPSTRATONCE, "Got unexpected lr %#Ix.\n", lr);
ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmSetCompositionStringA failed.\n"); flush_sequence(); ret = ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmNotifyIME failed.\n"); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(edit_eimes_getcompstratonce_seq, diff --git a/dlls/user32/tests/user32_test.h b/dlls/user32/tests/user32_test.h new file mode 100644 index 00000000000..30ef19cdcc1 --- /dev/null +++ b/dlls/user32/tests/user32_test.h @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> +#include <stddef.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" + +#include "wine/test.h" + +static inline BOOL is_driver( const WCHAR *match ) +{ + static WCHAR *cache; + + WCHAR *tmp = NULL, driver[MAX_PATH] = {0}, path[sizeof("System\CurrentControlSet\Control\Video\{}\0000") + 40]; + DWORD size = sizeof(driver); + UINT guid_atom; + HKEY key; + + if (cache) return !wcscmp( cache, match ); + + guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), L"__wine_display_device_guid" ) ); + wcscpy( path, L"System\CurrentControlSet\Control\Video\{" ); + if (GlobalGetAtomNameW( guid_atom, path + wcslen( path ), 40 )) + { + wcscat( path, L"}\0000" ); + if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, path, &key )) + { + if (!RegQueryValueExW( key, L"GraphicsDriver", NULL, NULL, (BYTE *)&driver, &size )) + tmp = wcsdup( driver ); + RegCloseKey(key); + } + } + + if (!tmp) tmp = wcsdup( L"" ); + if ((tmp = InterlockedExchangePointer( (void *)&cache, tmp ))) free( tmp ); + + return !wcscmp( cache, match ); +} diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 1252e046ad3..04ff254ee25 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -34,6 +34,8 @@
#include "wine/test.h"
+#include "user32_test.h" + #ifndef WM_SYSTIMER #define WM_SYSTIMER 0x0118 #endif @@ -8777,6 +8779,7 @@ static void test_GetWindowModuleFileName(void) "expected ERROR_INVALID_WINDOW_HANDLE, got %lu\n", GetLastError());
hwnd = FindWindowA("Shell_TrayWnd", NULL); + todo_wine_if(is_driver( L"null" )) ok(IsWindow(hwnd) || broken(!hwnd), "got invalid tray window %p\n", hwnd); SetLastError(0xdeadbeef); ret1 = pGetWindowModuleFileNameA(hwnd, buf1, sizeof(buf1)); @@ -9871,8 +9874,10 @@ static void test_FindWindowEx(void)
/* test behaviour with a window title that is an empty character */ found = FindWindowExA( 0, 0, "Shell_TrayWnd", "" ); + todo_wine_if(is_driver( L"null" )) ok( found != NULL, "found is NULL, expected a valid hwnd\n" ); found = FindWindowExA( 0, 0, "Shell_TrayWnd", NULL ); + todo_wine_if(is_driver( L"null" )) ok( found != NULL, "found is NULL, expected a valid hwnd\n" ); }
@@ -9927,8 +9932,10 @@ static void test_FindWindow(void)
/* test behaviour with a window title that is an empty character */ found = FindWindowA( "Shell_TrayWnd", "" ); + todo_wine_if(is_driver( L"null" )) ok( found != NULL, "found is NULL, expected a valid hwnd\n" ); found = FindWindowA( "Shell_TrayWnd", NULL ); + todo_wine_if(is_driver( L"null" )) ok( found != NULL, "found is NULL, expected a valid hwnd\n" ); }