Author: akhaldi
Date: Thu May 17 16:22:34 2012
New Revision: 56601
URL:
http://svn.reactos.org/svn/reactos?rev=56601&view=rev
Log:
[USER32_WINETEST]
* Sync to Wine 1.5.4.
Modified:
trunk/rostests/winetests/user32/cursoricon.c
trunk/rostests/winetests/user32/dialog.c
trunk/rostests/winetests/user32/input.c
trunk/rostests/winetests/user32/win.c
Modified: trunk/rostests/winetests/user32/cursoricon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/cursoric…
==============================================================================
--- trunk/rostests/winetests/user32/cursoricon.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/cursoricon.c [iso-8859-1] Thu May 17 16:22:34 2012
@@ -1926,8 +1926,8 @@
check_DrawIconEx(hdcDst, FALSE, 0x00A0B0C0, 32, 0, 0x00102030, 0x00102030,
0x00102030, __LINE__);
check_DrawIconEx(hdcDst, TRUE, 0x00A0B0C0, 32, 0, 0x00102030, 0x00102030, 0x00102030,
__LINE__);
- check_DrawIconEx(hdcDst, FALSE, 0x80A0B0C0, 32, DI_MASK, 0x00FFFFFF, 0x00000000,
0x00000000, __LINE__);
- check_DrawIconEx(hdcDst, TRUE, 0x80A0B0C0, 32, DI_MASK, 0x00FFFFFF, 0x00FFFFFF,
0x00FFFFFF, __LINE__);
+ check_DrawIconEx(hdcDst, FALSE, 0x80A0B0C0, 32, DI_MASK, 0x00123456, 0x00000000,
0x00000000, __LINE__);
+ check_DrawIconEx(hdcDst, TRUE, 0x80A0B0C0, 32, DI_MASK, 0x00123456, 0x00FFFFFF,
0x00FFFFFF, __LINE__);
check_DrawIconEx(hdcDst, FALSE, 0x00A0B0C0, 32, DI_IMAGE, 0x00FFFFFF, 0x00C0B0A0,
0x00C0B0A0, __LINE__);
check_DrawIconEx(hdcDst, TRUE, 0x00A0B0C0, 32, DI_IMAGE, 0x00FFFFFF, 0x00C0B0A0,
0x00C0B0A0, __LINE__);
Modified: trunk/rostests/winetests/user32/dialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/dialog.c…
==============================================================================
--- trunk/rostests/winetests/user32/dialog.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/dialog.c [iso-8859-1] Thu May 17 16:22:34 2012
@@ -1066,20 +1066,38 @@
static INT_PTR CALLBACK TestReturnKeyDlgProc (HWND hDlg, UINT uiMsg,
WPARAM wParam, LPARAM lParam)
{
- static int received_idok = 0;
+ static int received_idok;
+
switch (uiMsg)
{
case WM_INITDIALOG:
- {
- MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001};
- IsDialogMessage(hDlg, &msg);
- }
- ok(received_idok, "WM_COMMAND not received\n");
+ {
+ MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001};
+
+ received_idok = -1;
+ IsDialogMessage(hDlg, &msg);
+ ok(received_idok == 0xdead, "WM_COMMAND/0xdead not received\n");
+
+ received_idok = -2;
+ IsDialogMessage(hDlg, &msg);
+ ok(received_idok == IDOK, "WM_COMMAND/IDOK not received\n");
+
EndDialog(hDlg, 0);
return TRUE;
+ }
+
+ case DM_GETDEFID:
+ if (received_idok == -1)
+ {
+ HWND hwnd = GetDlgItem(hDlg, 0xdead);
+ ok(!hwnd, "dialog item with ID 0xdead should not exist\n");
+ SetWindowLong(hDlg, DWLP_MSGRESULT, MAKELRESULT(0xdead, DC_HASDEFID));
+ return TRUE;
+ }
+ return FALSE;
+
case WM_COMMAND:
- ok(wParam==IDOK, "Expected IDOK\n");
- received_idok = 1;
+ received_idok = wParam;
return TRUE;
}
return FALSE;
Modified: trunk/rostests/winetests/user32/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/input.c?…
==============================================================================
--- trunk/rostests/winetests/user32/input.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/input.c [iso-8859-1] Thu May 17 16:22:34 2012
@@ -1603,6 +1603,46 @@
ok(!strcmp(klid, "00000409"), "expected 00000409, got %s\n",
klid);
}
+static void test_key_names(void)
+{
+ char buffer[40];
+ WCHAR bufferW[40];
+ int ret, prev;
+ LONG lparam = 0x1d << 16;
+
+ memset( buffer, 0xcc, sizeof(buffer) );
+ ret = GetKeyNameTextA( lparam, buffer, sizeof(buffer) );
+ ok( ret > 0, "wrong len %u for '%s'\n", ret, buffer );
+ ok( ret == strlen(buffer), "wrong len %u for '%s'\n", ret, buffer
);
+
+ memset( buffer, 0xcc, sizeof(buffer) );
+ prev = ret;
+ ret = GetKeyNameTextA( lparam, buffer, prev );
+ ok( ret == prev - 1, "wrong len %u for '%s'\n", ret, buffer );
+ ok( ret == strlen(buffer), "wrong len %u for '%s'\n", ret, buffer
);
+
+ memset( buffer, 0xcc, sizeof(buffer) );
+ ret = GetKeyNameTextA( lparam, buffer, 0 );
+ ok( ret == 0, "wrong len %u for '%s'\n", ret, buffer );
+ ok( buffer[0] == 0, "wrong string '%s'\n", buffer );
+
+ memset( bufferW, 0xcc, sizeof(bufferW) );
+ ret = GetKeyNameTextW( lparam, bufferW, sizeof(bufferW)/sizeof(WCHAR) );
+ ok( ret > 0, "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW) );
+ ok( ret == lstrlenW(bufferW), "wrong len %u for %s\n", ret,
wine_dbgstr_w(bufferW) );
+
+ memset( bufferW, 0xcc, sizeof(bufferW) );
+ prev = ret;
+ ret = GetKeyNameTextW( lparam, bufferW, prev );
+ ok( ret == prev - 1, "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW)
);
+ ok( ret == lstrlenW(bufferW), "wrong len %u for %s\n", ret,
wine_dbgstr_w(bufferW) );
+
+ memset( bufferW, 0xcc, sizeof(bufferW) );
+ ret = GetKeyNameTextW( lparam, bufferW, 0 );
+ ok( ret == 0, "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW) );
+ ok( bufferW[0] == 0xcccc, "wrong string %s\n", wine_dbgstr_w(bufferW) );
+}
+
START_TEST(input)
{
init_function_pointers();
@@ -1621,6 +1661,7 @@
test_ToUnicode();
test_get_async_key_state();
test_keyboard_layout_name();
+ test_key_names();
if(pGetMouseMovePointsEx)
test_GetMouseMovePointsEx();
Modified: trunk/rostests/winetests/user32/win.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/win.c?re…
==============================================================================
--- trunk/rostests/winetests/user32/win.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/win.c [iso-8859-1] Thu May 17 16:22:34 2012
@@ -6710,7 +6710,7 @@
SetLastError(0xdeadbeef);
ret = pFlashWindowEx(&finfo);
- todo_wine ok(!ret, "FlashWindowEx succeeded\n");
+ todo_wine ok(!ret, "previous window state should not be active\n");
finfo.cbSize = sizeof(FLASHWINFO) - 1;
SetLastError(0xdeadbeef);
@@ -6750,7 +6750,7 @@
SetLastError(0xdeadbeef);
ret = pFlashWindowEx(&finfo);
- todo_wine ok(!ret, "FlashWindowEx succeeded\n");
+ ok(ret, "previous window state should be active\n");
ok(finfo.cbSize == sizeof(FLASHWINFO), "FlashWindowEx modified cdSize to
%x\n", finfo.cbSize);
ok(finfo.hwnd == hwnd, "FlashWindowEx modified hwnd to %p\n", finfo.hwnd);
@@ -6761,7 +6761,8 @@
finfo.dwFlags = FLASHW_STOP;
SetLastError(0xdeadbeef);
ret = pFlashWindowEx(&finfo);
- ok(ret, "FlashWindowEx failed with %d\n", GetLastError());
+todo_wine
+ ok(!ret, "previous window state should not be active\n");
DestroyWindow( hwnd );
}
@@ -6820,6 +6821,238 @@
DestroyWindow( hwndPopup2 );
DestroyWindow( hwndPopup1 );
DestroyWindow( hwndOwner );
+}
+
+static LRESULT WINAPI my_httrasparent_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+ if (msg == WM_NCHITTEST) return HTTRANSPARENT;
+ return DefWindowProc(hwnd, msg, wp, lp);
+}
+
+static LRESULT WINAPI my_window_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+ return DefWindowProc(hwnd, msg, wp, lp);
+}
+
+static void create_window_tree(HWND parent, HWND *window, int size)
+{
+ static const DWORD style[] = { 0, WS_VISIBLE, WS_DISABLED, WS_VISIBLE | WS_DISABLED
};
+ int i, pos;
+
+ memset(window, 0, size * sizeof(window[0]));
+
+ pos = 0;
+ for (i = 0; i < sizeof(style)/sizeof(style[0]); i++)
+ {
+ assert(pos < size);
+ window[pos] = CreateWindowEx(0, "my_window", NULL, style[i] |
WS_CHILD,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ assert(pos < size);
+ window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_window", NULL,
style[i] | WS_CHILD,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+
+ assert(pos < size);
+ window[pos] = CreateWindowEx(0, "my_httrasparent", NULL, style[i] |
WS_CHILD,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ assert(pos < size);
+ window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_httrasparent",
NULL, style[i] | WS_CHILD,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+
+ assert(pos < size);
+ window[pos] = CreateWindowEx(0, "my_button", NULL, style[i] | WS_CHILD
| BS_GROUPBOX,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ assert(pos < size);
+ window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_button", NULL,
style[i] | WS_CHILD | BS_GROUPBOX,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ assert(pos < size);
+ window[pos] = CreateWindowEx(0, "my_button", NULL, style[i] | WS_CHILD
| BS_PUSHBUTTON,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ assert(pos < size);
+ window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_button", NULL,
style[i] | WS_CHILD | BS_PUSHBUTTON,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+
+ assert(pos < size);
+ window[pos] = CreateWindowEx(0, "Button", NULL, style[i] | WS_CHILD |
BS_GROUPBOX,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ assert(pos < size);
+ window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Button", NULL,
style[i] | WS_CHILD | BS_GROUPBOX,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ assert(pos < size);
+ window[pos] = CreateWindowEx(0, "Button", NULL, style[i] | WS_CHILD |
BS_PUSHBUTTON,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ assert(pos < size);
+ window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Button", NULL,
style[i] | WS_CHILD | BS_PUSHBUTTON,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+
+ assert(pos < size);
+ window[pos] = CreateWindowEx(0, "Static", NULL, style[i] | WS_CHILD,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ assert(pos < size);
+ window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Static", NULL,
style[i] | WS_CHILD,
+ 0, 0, 100, 100, parent, 0, 0, NULL);
+ ok(window[pos] != 0, "CreateWindowEx failed\n");
+ pos++;
+ }
+}
+
+struct window_attributes
+{
+ char class_name[128];
+ int is_visible, is_enabled, is_groupbox, is_httransparent, is_extransparent;
+};
+
+static void get_window_attributes(HWND hwnd, struct window_attributes *attrs)
+{
+ DWORD style, ex_style, hittest;
+
+ style = GetWindowLong(hwnd, GWL_STYLE);
+ ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ attrs->class_name[0] = 0;
+ GetClassName(hwnd, attrs->class_name, sizeof(attrs->class_name));
+ hittest = SendMessage(hwnd, WM_NCHITTEST, 0, 0);
+
+ attrs->is_visible = (style & WS_VISIBLE) != 0;
+ attrs->is_enabled = (style & WS_DISABLED) == 0;
+ attrs->is_groupbox = !lstrcmpi(attrs->class_name, "Button")
&& (style & BS_TYPEMASK) == BS_GROUPBOX;
+ attrs->is_httransparent = hittest == HTTRANSPARENT;
+ attrs->is_extransparent = (ex_style & WS_EX_TRANSPARENT) != 0;
+}
+
+static int window_to_index(HWND hwnd, HWND *window, int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++)
+ {
+ if (!window[i]) break;
+ if (window[i] == hwnd) return i;
+ }
+ return -1;
+}
+
+static void test_child_window_from_point(void)
+{
+ static const int real_child_pos[] = { 14,15,16,17,18,19,20,21,24,25,26,27,42,43,
+ 44,45,46,47,48,49,52,53,54,55,51,50,23,22,-1
};
+ static const int real_child_pos_nt4[] = { 14,15,16,17,20,21,24,25,26,27,42,43,44,45,
+
48,49,52,53,54,55,51,50,47,46,23,22,19,18,-1 };
+ WNDCLASSA cls;
+ HWND hwnd, parent, window[100];
+ POINT pt;
+ int found_invisible, found_disabled, found_groupbox, found_httransparent,
found_extransparent;
+ int ret, i;
+
+ ret = GetClassInfo(0, "Button", &cls);
+ ok(ret, "GetClassInfo(Button) failed\n");
+ cls.lpszClassName = "my_button";
+ ret = RegisterClass(&cls);
+ ok(ret, "RegisterClass(my_button) failed\n");
+
+ cls.lpszClassName = "my_httrasparent";
+ cls.lpfnWndProc = my_httrasparent_proc;
+ ret = RegisterClass(&cls);
+ ok(ret, "RegisterClass(my_httrasparent) failed\n");
+
+ cls.lpszClassName = "my_window";
+ cls.lpfnWndProc = my_window_proc;
+ ret = RegisterClass(&cls);
+ ok(ret, "RegisterClass(my_window) failed\n");
+
+ parent = CreateWindowEx(0, "MainWindowClass", NULL,
+ WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX |
WS_POPUP | WS_VISIBLE,
+ 100, 100, 200, 200,
+ 0, 0, GetModuleHandle(0), NULL);
+ ok(parent != 0, "CreateWindowEx failed\n");
+ trace("parent %p\n", parent);
+
+ create_window_tree(parent, window, sizeof(window)/sizeof(window[0]));
+
+ found_invisible = 0;
+ found_disabled = 0;
+ found_groupbox = 0;
+ found_httransparent = 0;
+ found_extransparent = 0;
+
+ /* FIXME: also test WindowFromPoint, ChildWindowFromPoint, ChildWindowFromPointEx */
+ for (i = 0; i < sizeof(real_child_pos)/sizeof(real_child_pos[0]); i++)
+ {
+ struct window_attributes attrs;
+
+ pt.x = pt.y = 50;
+ hwnd = RealChildWindowFromPoint(parent, pt);
+ ok(hwnd != 0, "RealChildWindowFromPoint failed\n");
+ ret = window_to_index(hwnd, window, sizeof(window)/sizeof(window[0]));
+ /* FIXME: remove once Wine is fixed */
+ if (ret != real_child_pos[i])
+ todo_wine ok(ret == real_child_pos[i] || broken(ret ==
real_child_pos_nt4[i]), "expected %d, got %d\n", real_child_pos[i], ret);
+ else
+ ok(ret == real_child_pos[i] || broken(ret == real_child_pos_nt4[i]),
"expected %d, got %d\n", real_child_pos[i], ret);
+
+ get_window_attributes(hwnd, &attrs);
+ if (!attrs.is_visible) found_invisible++;
+ if (!attrs.is_enabled) found_disabled++;
+ if (attrs.is_groupbox) found_groupbox++;
+ if (attrs.is_httransparent) found_httransparent++;
+ if (attrs.is_extransparent) found_extransparent++;
+
+ if (ret != real_child_pos[i] && ret != -1)
+ {
+ trace("found hwnd %p (%s), is_visible %d, is_enabled %d, is_groupbox %d,
is_httransparent %d, is_extransparent %d\n",
+ hwnd, attrs.class_name, attrs.is_visible, attrs.is_enabled,
attrs.is_groupbox, attrs.is_httransparent, attrs.is_extransparent);
+ get_window_attributes(window[real_child_pos[i]], &attrs);
+ trace("expected hwnd %p (%s), is_visible %d, is_enabled %d, is_groupbox
%d, is_httransparent %d, is_extransparent %d\n",
+ window[real_child_pos[i]], attrs.class_name, attrs.is_visible,
attrs.is_enabled, attrs.is_groupbox, attrs.is_httransparent, attrs.is_extransparent);
+ }
+ if (ret == -1)
+ {
+ ok(hwnd == parent, "expected %p, got %p\n", parent, hwnd);
+ break;
+ }
+ DestroyWindow(hwnd);
+ }
+
+ DestroyWindow(parent);
+
+ ok(!found_invisible, "found %d invisible windows\n", found_invisible);
+ ok(found_disabled, "found %d disabled windows\n", found_disabled);
+todo_wine
+ ok(found_groupbox == 4, "found %d groupbox windows\n", found_groupbox);
+ ok(found_httransparent, "found %d httransparent windows\n",
found_httransparent);
+todo_wine
+ ok(found_extransparent, "found %d extransparent windows\n",
found_extransparent);
+
+ ret = UnregisterClass("my_button", cls.hInstance);
+ ok(ret, "UnregisterClass(my_button) failed\n");
+ ret = UnregisterClass("my_httrasparent", cls.hInstance);
+ ok(ret, "UnregisterClass(my_httrasparent) failed\n");
+ ret = UnregisterClass("my_window", cls.hInstance);
+ ok(ret, "UnregisterClass(my_window) failed\n");
}
START_TEST(win)
@@ -6872,6 +7105,7 @@
our_pid = GetWindowThreadProcessId(hwndMain, NULL);
/* Add the tests below this line */
+ test_child_window_from_point();
test_thick_child_size(hwndMain);
test_fullscreen();
test_hwnd_message();