[USER32_WINETEST] Sync with Wine Staging 2.9 except win.c. CORE-13362

svn path=/trunk/; revision=74909
This commit is contained in:
Amine Khaldi 2017-06-04 14:34:15 +00:00
parent e7bfd19443
commit 29d9f9eb31
15 changed files with 2578 additions and 304 deletions

View file

@ -685,9 +685,16 @@ static void test_builtinproc(void)
cls.lpfnWndProc = pDefWindowProcW;
atom = RegisterClassExA(&cls);
hwnd = CreateWindowExW(0, classW, NULL, WS_OVERLAPPEDWINDOW,
hwnd = CreateWindowExW(0, classW, unistring, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleW(NULL), 0);
ok(IsWindowUnicode(hwnd), "Windows should be Unicode\n");
ok(IsWindowUnicode(hwnd) ||
broken(!IsWindowUnicode(hwnd)) /* Windows 8 and 10 */,
"Windows should be Unicode\n");
SendMessageW(hwnd, WM_GETTEXT, sizeof(buf) / sizeof(buf[0]), (LPARAM)buf);
if (IsWindowUnicode(hwnd))
ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
else
ok(memcmp(buf, unistring, sizeof(unistring)) != 0, "WM_GETTEXT invalid return\n");
SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)pDefWindowProcA);
ok(IsWindowUnicode(hwnd), "Windows should have remained Unicode\n");
if (GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcA)

File diff suppressed because it is too large Load diff

View file

@ -32,8 +32,8 @@ static HWND hMainWnd;
#define expect_eq(expr, value, type, fmt); { type val = expr; ok(val == (value), #expr " expected " #fmt " got " #fmt "\n", (value), val); }
#define expect_rect(r, _left, _top, _right, _bottom) ok(r.left == _left && r.top == _top && \
r.bottom == _bottom && r.right == _right, "Invalid rect (%d,%d) (%d,%d) vs (%d,%d) (%d,%d)\n", \
r.left, r.top, r.right, r.bottom, _left, _top, _right, _bottom);
r.bottom == _bottom && r.right == _right, "Invalid rect %s vs (%d,%d)-(%d,%d)\n", \
wine_dbgstr_rect(&r), _left, _top, _right, _bottom);
static HWND build_combo(DWORD style)
{

View file

@ -83,6 +83,7 @@ typedef struct {
typedef struct {
BYTE data[32*32*4];
BYTE mask_data[32*32/8];
} ani_data32x32x32;
typedef struct {
@ -2621,7 +2622,9 @@ static void test_monochrome_icon(void)
CloseHandle(handle);
handle = LoadImageA(NULL, "icon.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
ok(handle != NULL, "LoadImage() failed with %u.\n", GetLastError());
ok(handle != NULL ||
broken(use_core_info && handle == NULL), /* Win 8, 10 */
"LoadImage() failed with %u.\n", GetLastError());
if (handle == NULL)
{
skip("Icon failed to load: %s, %s\n",

View file

@ -110,6 +110,12 @@ static void test_dc_attributes(void)
}
while (i > 0) ReleaseDC( hwnd_cache, hdcs[--i] );
/* Released cache DCs are 'disabled' */
rop = SetROP2( old_hdc, R2_BLACK );
ok( rop == 0, "got %d\n", rop );
rop = GetROP2( old_hdc );
ok( rop == 0, "got %d\n", rop );
/* test own DC */
hdc = GetDC( hwnd_owndc );
@ -335,10 +341,8 @@ static void test_dc_visrgn(void)
GetClipBox( hdc, &parent_rect );
ReleaseDC( hwnd_parent, hdc );
ok( rect.left == parent_rect.left, "rect.left = %d, expected %d\n", rect.left, parent_rect.left );
ok( rect.top == parent_rect.top, "rect.top = %d, expected %d\n", rect.top, parent_rect.top );
ok( rect.right == parent_rect.right, "rect.right = %d, expected %d\n", rect.right, parent_rect.right );
ok( rect.bottom == parent_rect.bottom, "rect.bottom = %d, expected %d\n", rect.bottom, parent_rect.bottom );
ok( EqualRect( &rect, &parent_rect ), "rect = %s, expected %s\n", wine_dbgstr_rect( &rect ),
wine_dbgstr_rect( &parent_rect ));
}

View file

@ -1550,17 +1550,32 @@ static void test_timer_message(void)
DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
}
static INT_PTR CALLBACK custom_test_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
static LRESULT CALLBACK msgbox_hook_proc(INT code, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_INITDIALOG)
EndDialog(hdlg, 0);
if (code == HCBT_ACTIVATE)
{
HWND msgbox = (HWND)wParam, msghwnd;
char text[64];
return FALSE;
}
if (msgbox)
{
text[0] = 0;
GetWindowTextA(msgbox, text, sizeof(text));
ok(!strcmp(text, "MSGBOX caption"), "Unexpected window text \"%s\"\n", text);
static void test_dialog_custom_data(void)
{
DialogBoxA(g_hinst, "CUSTOM_TEST_DIALOG", NULL, custom_test_dialog_proc);
msghwnd = GetDlgItem(msgbox, 0xffff);
ok(msghwnd != NULL, "Expected static control\n");
text[0] = 0;
GetWindowTextA(msghwnd, text, sizeof(text));
ok(!strcmp(text, "Text"), "Unexpected window text \"%s\"\n", text);
SendDlgItemMessageA(msgbox, IDCANCEL, WM_LBUTTONDOWN, 0, 0);
SendDlgItemMessageA(msgbox, IDCANCEL, WM_LBUTTONUP, 0, 0);
}
}
return CallNextHookEx(NULL, code, wParam, lParam);
}
struct create_window_params
@ -1623,9 +1638,18 @@ static void test_MessageBox(void)
{ MB_OK | MB_TASKMODAL, 0 },
{ MB_OK | MB_SYSTEMMODAL, WS_EX_TOPMOST },
};
DWORD tid, i;
HANDLE thread;
struct create_window_params params;
HANDLE thread;
DWORD tid, i;
HHOOK hook;
int ret;
hook = SetWindowsHookExA(WH_CBT, msgbox_hook_proc, NULL, GetCurrentThreadId());
ret = MessageBoxA(NULL, "Text", "MSGBOX caption", MB_OKCANCEL);
ok(ret == IDCANCEL, "got %d\n", ret);
UnhookWindowsHookEx(hook);
sprintf(params.caption, "pid %08x, tid %08x, time %08x",
GetCurrentProcessId(), GetCurrentThreadId(), GetCurrentTime());
@ -1673,13 +1697,25 @@ static void test_MessageBox(void)
}
}
static INT_PTR CALLBACK custom_test_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
if (msg == WM_INITDIALOG)
EndDialog(hdlg, 0);
return FALSE;
}
static void test_dialog_custom_data(void)
{
DialogBoxA(g_hinst, "CUSTOM_TEST_DIALOG", NULL, custom_test_dialog_proc);
}
START_TEST(dialog)
{
g_hinst = GetModuleHandleA (0);
if (!RegisterWindowClasses()) assert(0);
test_MessageBox();
test_dialog_custom_data();
test_GetNextDlgItem();
test_IsDialogMessage();
@ -1692,4 +1728,5 @@ START_TEST(dialog)
test_MessageBoxFontTest();
test_SaveRestoreFocus();
test_timer_message();
test_MessageBox();
}

View file

@ -53,6 +53,8 @@
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "winnls.h"
#include "wine/test.h"
@ -78,6 +80,7 @@ static struct {
static UINT (WINAPI *pSendInput) (UINT, INPUT*, size_t);
static int (WINAPI *pGetMouseMovePointsEx) (UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEPOINT, int, DWORD);
static UINT (WINAPI *pGetRawInputDeviceList) (PRAWINPUTDEVICELIST, PUINT, UINT);
static int (WINAPI *pGetWindowRgnBox)(HWND, LPRECT);
#define MAXKEYEVENTS 12
#define MAXKEYMESSAGES MAXKEYEVENTS /* assuming a key event generates one
@ -162,6 +165,7 @@ static void init_function_pointers(void)
GET_PROC(SendInput)
GET_PROC(GetMouseMovePointsEx)
GET_PROC(GetRawInputDeviceList)
GET_PROC(GetWindowRgnBox)
#undef GET_PROC
}
@ -1647,6 +1651,8 @@ static void test_ToUnicode(void)
const BYTE SC_RETURN = 0x1c, SC_TAB = 0x0f, SC_A = 0x1e;
const BYTE HIGHEST_BIT = 0x80;
int i, ret;
BOOL us_kbd = (GetKeyboardLayout(0) == (HKL)(ULONG_PTR)0x04090409);
for(i=0; i<256; i++)
state[i]=0;
@ -1673,7 +1679,10 @@ static void test_ToUnicode(void)
if(!vk)
{
short vk_ret = VkKeyScanW(utests[i].chr);
short vk_ret;
if (!us_kbd) continue;
vk_ret = VkKeyScanW(utests[i].chr);
if (vk_ret == -1) continue;
vk = vk_ret & 0xff;
if (vk_ret & 0x100) mod |= shift;
@ -1921,9 +1930,16 @@ static void test_Input_mouse(void)
struct thread_data thread_data;
HANDLE thread;
DWORD thread_id;
POINT pt;
WNDCLASSA wclass;
POINT pt, pt_org;
int region_type;
HRGN hregion;
RECT region;
BOOL ret;
MSG msg;
GetCursorPos(&pt_org);
button_win = CreateWindowA("button", "button", WS_VISIBLE | WS_POPUP,
100, 100, 100, 100, 0, NULL, NULL, NULL);
ok(button_win != 0, "CreateWindow failed\n");
@ -2124,6 +2140,224 @@ static void test_Input_mouse(void)
DestroyWindow(hwnd);
ok(ReleaseCapture(), "ReleaseCapture failed\n");
wclass.style = 0;
wclass.lpfnWndProc = WndProc;
wclass.cbClsExtra = 0;
wclass.cbWndExtra = 0;
wclass.hInstance = GetModuleHandleA(NULL);
wclass.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
wclass.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
wclass.hbrBackground = CreateSolidBrush(RGB(128, 128, 128));
wclass.lpszMenuName = NULL;
wclass.lpszClassName = "InputLayeredTestClass";
RegisterClassA( &wclass );
/* click through layered window with alpha channel / color key */
hwnd = CreateWindowA(wclass.lpszClassName, "InputLayeredTest",
WS_VISIBLE | WS_POPUP, 100, 100, 100, 100, button_win, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindowEx failed\n");
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetWindowLongA(hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
ret = SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA);
ok(ret, "SetLayeredWindowAttributes failed\n");
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
{
DispatchMessageA(&msg);
if (msg.message == WM_LBUTTONDOWN)
{
ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
got_button_down = TRUE;
}
else if (msg.message == WM_LBUTTONUP)
{
ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
got_button_up = TRUE;
break;
}
}
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
ret = SetLayeredWindowAttributes(hwnd, 0, 0, LWA_ALPHA);
ok(ret, "SetLayeredWindowAttributes failed\n");
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
{
DispatchMessageA(&msg);
if (msg.message == WM_LBUTTONDOWN)
{
todo_wine
ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
got_button_down = TRUE;
}
else if (msg.message == WM_LBUTTONUP)
{
todo_wine
ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
got_button_up = TRUE;
break;
}
}
ok(got_button_down || broken(!got_button_down), "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
ret = SetLayeredWindowAttributes(hwnd, RGB(0, 255, 0), 255, LWA_ALPHA | LWA_COLORKEY);
ok(ret, "SetLayeredWindowAttributes failed\n");
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
{
DispatchMessageA(&msg);
if (msg.message == WM_LBUTTONDOWN)
{
ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
got_button_down = TRUE;
}
else if (msg.message == WM_LBUTTONUP)
{
ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
got_button_up = TRUE;
break;
}
}
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
ret = SetLayeredWindowAttributes(hwnd, RGB(128, 128, 128), 0, LWA_COLORKEY);
ok(ret, "SetLayeredWindowAttributes failed\n");
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
{
DispatchMessageA(&msg);
if (msg.message == WM_LBUTTONDOWN)
{
ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
got_button_down = TRUE;
}
else if (msg.message == WM_LBUTTONUP)
{
ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
got_button_up = TRUE;
break;
}
}
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
SetWindowLongA(hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED);
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
{
DispatchMessageA(&msg);
if (msg.message == WM_LBUTTONDOWN)
{
ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
got_button_down = TRUE;
}
else if (msg.message == WM_LBUTTONUP)
{
ok(msg.hwnd == hwnd, "msg.hwnd = %p\n", msg.hwnd);
got_button_up = TRUE;
break;
}
}
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
hregion = CreateRectRgn(0, 0, 10, 10);
ok(hregion != NULL, "CreateRectRgn failed\n");
ret = SetWindowRgn(hwnd, hregion, TRUE);
ok(ret, "SetWindowRgn failed\n");
DeleteObject(hregion);
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(1000);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
{
DispatchMessageA(&msg);
if (msg.message == WM_LBUTTONDOWN)
{
ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
got_button_down = TRUE;
}
else if (msg.message == WM_LBUTTONUP)
{
ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
got_button_up = TRUE;
break;
}
}
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
DestroyWindow(hwnd);
SetCursorPos(pt_org.x, pt_org.y);
CloseHandle(thread_data.start_event);
CloseHandle(thread_data.end_event);
DestroyWindow(button_win);
@ -2493,6 +2727,36 @@ static void test_GetKeyState(void)
CloseHandle(semaphores[1]);
}
static void test_OemKeyScan(void)
{
DWORD ret, expect, vkey, scan;
WCHAR oem, wchr;
char oem_char;
for (oem = 0; oem < 0x200; oem++)
{
ret = OemKeyScan( oem );
oem_char = LOBYTE( oem );
if (!OemToCharBuffW( &oem_char, &wchr, 1 ))
expect = -1;
else
{
vkey = VkKeyScanW( wchr );
scan = MapVirtualKeyW( LOBYTE( vkey ), MAPVK_VK_TO_VSC );
if (!scan)
expect = -1;
else
{
vkey &= 0xff00;
vkey <<= 8;
expect = vkey | scan;
}
}
ok( ret == expect, "%04x: got %08x expected %08x\n", oem, ret, expect );
}
}
START_TEST(input)
{
init_function_pointers();
@ -2516,6 +2780,7 @@ START_TEST(input)
test_key_names();
test_attach_input();
test_GetKeyState();
test_OemKeyScan();
if(pGetMouseMovePointsEx)
test_GetMouseMovePointsEx();

View file

@ -2463,6 +2463,7 @@ static void test_menu_input(void) {
HANDLE hThread, hWnd;
DWORD tid;
ATOM aclass;
POINT orig_pos;
if (!pSendInput)
{
@ -2507,6 +2508,8 @@ static void test_menu_input(void) {
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
GetCursorPos(&orig_pos);
hThread = CreateThread(NULL, 0, test_menu_input_thread, hWnd, 0, &tid);
while(1)
{
@ -2514,6 +2517,7 @@ static void test_menu_input(void) {
break;
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
}
SetCursorPos(orig_pos.x, orig_pos.y);
DestroyWindow(hWnd);
}

View file

@ -89,12 +89,12 @@ static void test_enumdisplaydevices(void)
}
dd.cb = sizeof(dd);
while(1)
for (num = 0;; num++)
{
BOOL ret;
HDC dc;
ret = pEnumDisplayDevicesA(NULL, num, &dd, 0);
if(!ret) break;
if(dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
{
strcpy(primary_device_name, dd.DeviceName);
@ -107,7 +107,6 @@ static void test_enumdisplaydevices(void)
ok(dc != NULL, "Failed to CreateDC(\"%s\") err=%d\n", dd.DeviceName, GetLastError());
DeleteDC(dc);
}
num++;
}
if (primary_num == -1 || !pEnumDisplayMonitors || !pGetMonitorInfoA)
@ -122,6 +121,17 @@ static void test_enumdisplaydevices(void)
ok(!strcmp(primary_monitor_device_name, primary_device_name),
"monitor device name %s, device name %s\n", primary_monitor_device_name,
primary_device_name);
dd.cb = sizeof(dd);
for (num = 0;; num++)
{
ret = pEnumDisplayDevicesA(primary_device_name, num, &dd, 0);
if (!ret) break;
dd.DeviceID[63] = 0;
ok(!strcasecmp(dd.DeviceID, "Monitor\\Default_Monitor\\{4D36E96E-E325-11CE-BFC1-08002BE10318}\\"),
"DeviceID \"%s\" does not start with \"Monitor\\Default_Monitor\\...\" prefix\n", dd.DeviceID);
}
}
struct vid_mode
@ -131,9 +141,9 @@ struct vid_mode
};
static const struct vid_mode vid_modes_test[] = {
{640, 480, 0, 0, DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY, 1},
{640, 480, 0, 0, DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY, 0},
{640, 480, 0, 0, DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY, 1},
{640, 480, 0, 0, DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL , 1},
{640, 480, 0, 0, DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL , 0},
{640, 480, 0, 0, DM_PELSWIDTH | DM_PELSHEIGHT , 1},
{640, 480, 0, 0, DM_BITSPERPEL , 0},
{640, 480, 0, 0, DM_DISPLAYFREQUENCY, 0},

File diff suppressed because it is too large Load diff

View file

@ -75,6 +75,28 @@ FONT 8, "MS Shell Dlg"
PUSHBUTTON "Cancel", IDCANCEL,109,20,50,14, WS_TABSTOP | WS_GROUP
}
AUTORADIO_TEST_DIALOG_1 DIALOGEX 0, 0, 200, 200
STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
CAPTION "Radio Button Test Dialog"
FONT 8, "MS Shell Dlg"
{
CONTROL "Radio1",501,"my_button_class",WS_VISIBLE | WS_CHILD | WS_GROUP | BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,10,10,70,18
CONTROL "Radio3",503,"my_button_class",WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON | BS_NOTIFY | WS_TABSTOP,10,35,70,18
CONTROL "Text",504,"my_button_class",WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_NOTIFY | WS_TABSTOP,10,60,70,18
CONTROL "Radio2",502,"my_button_class",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,10,85,70,18
}
AUTORADIO_TEST_DIALOG_2 DIALOGEX 0, 0, 200, 200
STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
CAPTION "Radio Button Test Dialog"
FONT 8, "MS Shell Dlg"
{
CONTROL "Radio1",501,"my_button_class",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,10,10,70,18
CONTROL "Radio3",503,"my_button_class",WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON | BS_NOTIFY,10,35,70,18
CONTROL "Text",504,"my_button_class",WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_NOTIFY,10,60,70,18
CONTROL "Radio2",502,"my_button_class",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_NOTIFY,10,85,70,18
}
CLASS_TEST_DIALOG DIALOG 0, 0, 91, 28
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "CreateDialogParams Test"

View file

@ -40,9 +40,12 @@
#endif
static LONG (WINAPI *pChangeDisplaySettingsExA)(LPCSTR, LPDEVMODEA, HWND, DWORD, LPVOID);
static BOOL (WINAPI *pIsProcessDPIAware)(void);
static BOOL (WINAPI *pSetProcessDPIAware)(void);
static LONG (WINAPI *pGetAutoRotationState)(PAR_STATE);
static BOOL strict;
static int dpi;
static int dpi, real_dpi;
static BOOL iswin9x;
static HDC hdc;
@ -166,6 +169,36 @@ static int last_bpp;
static BOOL displaychange_ok = FALSE, displaychange_test_active = FALSE;
static HANDLE displaychange_sem = 0;
static BOOL get_reg_dword(HKEY base, const char *key_name, const char *value_name, DWORD *value)
{
HKEY key;
DWORD type, data, size = sizeof(data);
BOOL ret = FALSE;
if (RegOpenKeyA(base, key_name, &key) == ERROR_SUCCESS)
{
if (RegQueryValueExA(key, value_name, NULL, &type, (void *)&data, &size) == ERROR_SUCCESS &&
type == REG_DWORD)
{
*value = data;
ret = TRUE;
}
RegCloseKey(key);
}
return ret;
}
static DWORD get_real_dpi(void)
{
DWORD dpi;
if (get_reg_dword(HKEY_CURRENT_USER, "Control Panel\\Desktop", "LogPixels", &dpi))
return dpi;
if (get_reg_dword(HKEY_CURRENT_CONFIG, "Software\\Fonts", "LogPixels", &dpi))
return dpi;
return USER_DEFAULT_SCREEN_DPI;
}
static LRESULT CALLBACK SysParamsTestWndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam )
{
@ -872,7 +905,7 @@ static void test_SPI_SETKEYBOARDSPEED( void ) /* 10 */
static BOOL dotest_spi_iconhorizontalspacing( INT curr_val)
{
BOOL rc;
INT spacing, regval;
INT spacing, regval, min_val = MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI );
ICONMETRICSA im;
rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, curr_val, 0,
@ -880,7 +913,7 @@ static BOOL dotest_spi_iconhorizontalspacing( INT curr_val)
if (!test_error_msg(rc,"SPI_ICONHORIZONTALSPACING")) return FALSE;
ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
test_change_message( SPI_ICONHORIZONTALSPACING, 0 );
if( curr_val < 32) curr_val = 32;
curr_val = max( curr_val, min_val );
/* The registry keys depend on the Windows version and the values too
* let's test (works on win95,ME,NT4,2k,XP)
*/
@ -1041,7 +1074,7 @@ static void test_SPI_SETKEYBOARDDELAY( void ) /* 23 */
static BOOL dotest_spi_iconverticalspacing( INT curr_val)
{
BOOL rc;
INT spacing, regval;
INT spacing, regval, min_val = MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI );
ICONMETRICSA im;
rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, curr_val, 0,
@ -1049,7 +1082,7 @@ static BOOL dotest_spi_iconverticalspacing( INT curr_val)
if (!test_error_msg(rc,"SPI_ICONVERTICALSPACING")) return FALSE;
ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
test_change_message( SPI_ICONVERTICALSPACING, 0 );
if( curr_val < 32) curr_val = 32;
curr_val = max( curr_val, min_val );
/* The registry keys depend on the Windows version and the values too
* let's test (works on win95,ME,NT4,2k,XP)
*/
@ -1412,7 +1445,7 @@ static void test_SPI_SETDRAGFULLWINDOWS( void ) /* 37 */
#define test_reg_font( KEY, VAL, LF) \
{ LOGFONTA lfreg;\
lffromreg( KEY, VAL, &lfreg);\
ok( (lfreg.lfHeight < 0 ? (LF).lfHeight == lfreg.lfHeight :\
ok( (lfreg.lfHeight < 0 ? (LF).lfHeight == MulDiv( lfreg.lfHeight, dpi, real_dpi ) : \
MulDiv( -(LF).lfHeight , 72, dpi) == lfreg.lfHeight )&&\
(LF).lfWidth == lfreg.lfWidth &&\
(LF).lfWeight == lfreg.lfWeight &&\
@ -1476,12 +1509,14 @@ static void test_SPI_SETNONCLIENTMETRICS( void ) /* 44 */
the caption font height is higher than the CaptionHeight field,
the latter is adjusted accordingly. To be able to restore these setting
accurately be restore the raw values. */
Ncmorig.iCaptionWidth = metricfromreg( SPI_METRIC_REGKEY, SPI_CAPTIONWIDTH_VALNAME, dpi);
Ncmorig.iCaptionWidth = metricfromreg( SPI_METRIC_REGKEY, SPI_CAPTIONWIDTH_VALNAME, real_dpi);
Ncmorig.iCaptionHeight = metricfromreg( SPI_METRIC_REGKEY, SPI_CAPTIONHEIGHT_VALNAME, dpi);
Ncmorig.iSmCaptionHeight = metricfromreg( SPI_METRIC_REGKEY, SPI_SMCAPTIONHEIGHT_VALNAME, dpi);
Ncmorig.iMenuHeight = metricfromreg( SPI_METRIC_REGKEY, SPI_MENUHEIGHT_VALNAME, dpi);
/* test registry entries */
TEST_NONCLIENTMETRICS_REG( Ncmorig)
Ncmorig.lfCaptionFont.lfHeight = MulDiv( Ncmorig.lfCaptionFont.lfHeight, real_dpi, dpi );
/* make small changes */
Ncmnew = Ncmstart;
Ncmnew.iBorderWidth += 1;
@ -2671,7 +2706,7 @@ static void test_GetSystemMetrics( void)
HDC hdc = CreateICA( "Display", 0, 0, 0);
UINT avcwCaption;
INT CaptionWidthfromreg;
INT CaptionWidthfromreg, smicon, broken_val;
MINIMIZEDMETRICS minim;
NONCLIENTMETRICSA ncm;
SIZE screen;
@ -2738,8 +2773,9 @@ static void test_GetSystemMetrics( void)
ok_gsm( SM_CYDLGFRAME, 3);
ok_gsm( SM_CYVTHUMB, ncm.iScrollHeight);
ok_gsm( SM_CXHTHUMB, ncm.iScrollHeight);
/* SM_CXICON */
/* SM_CYICON */
/* These don't depend on the Shell Icon Size registry value */
ok_gsm( SM_CXICON, MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI ) );
ok_gsm( SM_CYICON, MulDiv( 32, dpi, USER_DEFAULT_SCREEN_DPI ) );
/* SM_CXCURSOR */
/* SM_CYCURSOR */
ok_gsm( SM_CYMENU, ncm.iMenuHeight + 1);
@ -2784,8 +2820,32 @@ static void test_GetSystemMetrics( void)
/* sign-extension for iHorzGap/iVertGap is broken on Win9x */
ok_gsm( SM_CXMINSPACING, GetSystemMetrics( SM_CXMINIMIZED) + (short)minim.iHorzGap );
ok_gsm( SM_CYMINSPACING, GetSystemMetrics( SM_CYMINIMIZED) + (short)minim.iVertGap );
/* SM_CXSMICON */
/* SM_CYSMICON */
smicon = MulDiv( 16, dpi, USER_DEFAULT_SCREEN_DPI );
if (!pIsProcessDPIAware || pIsProcessDPIAware())
smicon = max( min( smicon, CaptionWidthfromreg - 2), 4 ) & ~1;
todo_wine_if( real_dpi == dpi && smicon != (MulDiv( 16, dpi, USER_DEFAULT_SCREEN_DPI) & ~1) )
{
broken_val = (min( ncm.iCaptionHeight, CaptionWidthfromreg ) - 2) & ~1;
broken_val = min( broken_val, 20 );
if (smicon == 4)
{
ok_gsm_2( SM_CXSMICON, smicon, 6 );
ok_gsm_2( SM_CYSMICON, smicon, 6 );
}
else if (smicon < broken_val)
{
ok_gsm_2( SM_CXSMICON, smicon, broken_val );
ok_gsm_2( SM_CYSMICON, smicon, broken_val );
}
else
{
ok_gsm( SM_CXSMICON, smicon );
ok_gsm( SM_CYSMICON, smicon );
}
}
ok_gsm( SM_CYSMCAPTION, ncm.iSmCaptionHeight + 1);
ok_gsm_3( SM_CXSMSIZE,
ncm.iSmCaptionWidth, /* classic/standard windows style */
@ -2918,6 +2978,48 @@ static void test_GetSysColorBrush(void)
win_skip("COLOR_MENUBAR unsupported\n");
}
static void test_dpi_aware(void)
{
BOOL ret;
if (!pIsProcessDPIAware)
{
win_skip("IsProcessDPIAware not available\n");
return;
}
ret = pSetProcessDPIAware();
ok(ret, "got %d\n", ret);
ret = pIsProcessDPIAware();
ok(ret, "got %d\n", ret);
dpi = real_dpi;
test_GetSystemMetrics();
}
static void test_GetAutoRotationState(void)
{
AR_STATE state;
BOOL ret;
if (!pGetAutoRotationState)
{
win_skip("GetAutoRotationState not supported\n");
return;
}
SetLastError(0xdeadbeef);
ret = pGetAutoRotationState(NULL);
ok(!ret, "Expected GetAutoRotationState to fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
state = 0;
ret = pGetAutoRotationState(&state);
ok(ret, "Expected GetAutoRotationState to succeed, error %d\n", GetLastError());
ok((state & AR_NOSENSOR) != 0, "Expected AR_NOSENSOR, got %d\n", state);
}
START_TEST(sysparams)
{
int argc;
@ -2929,11 +3031,16 @@ START_TEST(sysparams)
HANDLE hInstance, hdll;
hdll = GetModuleHandleA("user32.dll");
pChangeDisplaySettingsExA=(void*)GetProcAddress(hdll, "ChangeDisplaySettingsExA");
pChangeDisplaySettingsExA = (void*)GetProcAddress(hdll, "ChangeDisplaySettingsExA");
pIsProcessDPIAware = (void*)GetProcAddress(hdll, "IsProcessDPIAware");
pSetProcessDPIAware = (void*)GetProcAddress(hdll, "SetProcessDPIAware");
pGetAutoRotationState = (void*)GetProcAddress(hdll, "GetAutoRotationState");
hInstance = GetModuleHandleA( NULL );
hdc = GetDC(0);
dpi = GetDeviceCaps( hdc, LOGPIXELSY);
real_dpi = get_real_dpi();
trace("dpi %d real_dpi %d\n", dpi, real_dpi);
iswin9x = GetVersion() & 0x80000000;
/* This test requires interactivity, if we don't have it, give up */
@ -2949,6 +3056,7 @@ START_TEST(sysparams)
trace("testing EnumDisplaySettings vs GetDeviceCaps\n");
test_EnumDisplaySettings( );
test_GetSysColorBrush( );
test_GetAutoRotationState( );
change_counter = 0;
change_last_param = 0;
@ -2978,4 +3086,5 @@ START_TEST(sysparams)
}
ReleaseDC( 0, hdc);
test_dpi_aware();
}

View file

@ -26,6 +26,7 @@
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "winnls.h"
#define MODIFIED(rect) (rect.left == 10 && rect.right != 100 && rect.top == 10 && rect.bottom != 100)
#define EMPTY(rect) (rect.left == rect.right && rect.bottom == rect.top)
@ -746,6 +747,8 @@ static void test_CharToOem_OemToChar(void)
};
BOOL ret;
int i;
char oem;
WCHAR uni, expect;
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
{
@ -807,6 +810,15 @@ static void test_CharToOem_OemToChar(void)
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!lstrcmpW(buf, expected), "test %d: got '%s'\n", i, wine_dbgstr_w(buf));
}
for (i = 0; i < 0x100; i++)
{
oem = i;
ret = OemToCharBuffW( &oem, &uni, 1 );
ok( ret, "%02x: returns FALSE\n", i );
MultiByteToWideChar( CP_OEMCP, MB_PRECOMPOSED | MB_USEGLYPHCHARS, &oem, 1, &expect, 1 );
ok( uni == expect, "%02x: got %04x expected %04x\n", i, uni, expect );
}
}
START_TEST(text)

View file

@ -169,7 +169,7 @@ static void test_IsRectEmpty(void)
{{-11, -13, -19, -23}, TRUE},
{{11, 13, -17, 19}, TRUE},
{{11, 13, 17, 11}, TRUE},
/* Non emty rects */
/* Non empty rects */
{{101, 103, 107, 109}, FALSE},
{{1, -9, 7, 3}, FALSE},
{{-109, -107, -103, -101}, FALSE},

View file

@ -119,7 +119,6 @@ static void CharUpperTest(void)
for (i=0;i<256;i++)
{
out = (INT_PTR)CharUpperA((LPSTR)i);
/* printf("%0x ",out); */
if ((out >> 16) != 0)
{
failed = TRUE;
@ -137,7 +136,6 @@ static void CharLowerTest(void)
for (i=0;i<256;i++)
{
out = (INT_PTR)CharLowerA((LPSTR)i);
/* printf("%0x ",out); */
if ((out >> 16) != 0)
{
failed = TRUE;