Author: jimtabor
Date: Sun Feb 21 04:11:32 2010
New Revision: 45643
URL:
http://svn.reactos.org/svn/reactos?rev=45643&view=rev
Log:
- Sync to wine release 1.1.39.
Modified:
trunk/rostests/winetests/user32/combo.c
trunk/rostests/winetests/user32/edit.c
trunk/rostests/winetests/user32/input.c
trunk/rostests/winetests/user32/menu.c
trunk/rostests/winetests/user32/msg.c
trunk/rostests/winetests/user32/win.c
Modified: trunk/rostests/winetests/user32/combo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/combo.c?…
==============================================================================
--- trunk/rostests/winetests/user32/combo.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/combo.c [iso-8859-1] Sun Feb 21 04:11:32 2010
@@ -401,6 +401,106 @@
DestroyWindow(hCombo);
}
+static void test_editselection(void)
+{
+ HWND hCombo;
+ INT start,end;
+ HWND hEdit;
+ COMBOBOXINFO cbInfo;
+ BOOL ret;
+ DWORD len;
+ BOOL (WINAPI *pGetComboBoxInfo)(HWND, PCOMBOBOXINFO);
+ char edit[20];
+
+ pGetComboBoxInfo = (void*)GetProcAddress(GetModuleHandleA("user32.dll"),
"GetComboBoxInfo");
+ if (!pGetComboBoxInfo){
+ win_skip("GetComboBoxInfo is not available\n");
+ return;
+ }
+
+ /* Build a combo */
+ hCombo = build_combo(CBS_SIMPLE);
+ cbInfo.cbSize = sizeof(COMBOBOXINFO);
+ SetLastError(0xdeadbeef);
+ ret = pGetComboBoxInfo(hCombo, &cbInfo);
+ ok(ret, "Failed to get combobox info structure. LastError=%d\n",
+ GetLastError());
+ hEdit = cbInfo.hwndItem;
+
+ /* Initially combo selection is empty*/
+ len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+ ok(LOWORD(len)==0, "Unexpected start position for selection %d\n",
LOWORD(len));
+ ok(HIWORD(len)==0, "Unexpected end position for selection %d\n",
HIWORD(len));
+
+ /* Set some text, and press a key to replace it */
+ edit[0] = 0x00;
+ SendMessage(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason1");
+ SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
+ ok(strcmp(edit, "Jason1")==0, "Unexpected text retrieved %s\n",
edit);
+
+ /* Now what is the selection - still empty */
+ SendMessage(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
+ len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+ ok(LOWORD(len)==0, "Unexpected start position for selection %d\n",
LOWORD(len));
+ ok(HIWORD(len)==0, "Unexpected end position for selection %d\n",
HIWORD(len));
+
+ /* Give it focus, and it gets selected */
+ SendMessage(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
+ SendMessage(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
+ len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+ ok(LOWORD(len)==0, "Unexpected start position for selection %d\n",
LOWORD(len));
+ ok(HIWORD(len)==6, "Unexpected end position for selection %d\n",
HIWORD(len));
+
+ /* Now emulate a key press */
+ edit[0] = 0x00;
+ SendMessage(hCombo, WM_CHAR, 'A', 0x1c0001);
+ SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
+ ok(strcmp(edit, "A")==0, "Unexpected text retrieved %s\n",
edit);
+
+ len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+ ok(LOWORD(len)==1, "Unexpected start position for selection %d\n",
LOWORD(len));
+ ok(HIWORD(len)==1, "Unexpected end position for selection %d\n",
HIWORD(len));
+
+ /* Now what happens when it gets more focus a second time - it doesnt reselect */
+ SendMessage(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
+ len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+ ok(LOWORD(len)==1, "Unexpected start position for selection %d\n",
LOWORD(len));
+ ok(HIWORD(len)==1, "Unexpected end position for selection %d\n",
HIWORD(len));
+ DestroyWindow(hCombo);
+
+ /* Start again - Build a combo */
+ hCombo = build_combo(CBS_SIMPLE);
+ cbInfo.cbSize = sizeof(COMBOBOXINFO);
+ SetLastError(0xdeadbeef);
+ ret = pGetComboBoxInfo(hCombo, &cbInfo);
+ ok(ret, "Failed to get combobox info structure. LastError=%d\n",
+ GetLastError());
+ hEdit = cbInfo.hwndItem;
+
+ /* Set some text and give focus so it gets selected */
+ edit[0] = 0x00;
+ SendMessage(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason2");
+ SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
+ ok(strcmp(edit, "Jason2")==0, "Unexpected text retrieved %s\n",
edit);
+
+ SendMessage(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
+
+ /* Now what is the selection */
+ SendMessage(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
+ len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+ ok(LOWORD(len)==0, "Unexpected start position for selection %d\n",
LOWORD(len));
+ ok(HIWORD(len)==6, "Unexpected end position for selection %d\n",
HIWORD(len));
+
+ /* Now change the selection to the apparently invalid start -1, end -1 and
+ show it means no selection (ie start -1) but cursor at end */
+ SendMessage(hCombo, CB_SETEDITSEL, 0, -1);
+ edit[0] = 0x00;
+ SendMessage(hCombo, WM_CHAR, 'A', 0x1c0001);
+ SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
+ ok(strcmp(edit, "Jason2A")==0, "Unexpected text retrieved %s\n",
edit);
+ DestroyWindow(hCombo);
+}
+
START_TEST(combo)
{
hMainWnd = CreateWindow("static", "Test", WS_OVERLAPPEDWINDOW,
10, 10, 300, 300, NULL, NULL, NULL, 0);
@@ -414,6 +514,7 @@
test_WM_LBUTTONDOWN();
test_changesize(CBS_DROPDOWN);
test_changesize(CBS_DROPDOWNLIST);
+ test_editselection();
DestroyWindow(hMainWnd);
}
Modified: trunk/rostests/winetests/user32/edit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/edit.c?r…
==============================================================================
--- trunk/rostests/winetests/user32/edit.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/edit.c [iso-8859-1] Sun Feb 21 04:11:32 2010
@@ -868,6 +868,14 @@
len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
test_notify(1, 0, 1);
+
+ len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
+ ok(LOWORD(len)==0, "Unexpected start position for selection %d\n",
LOWORD(len));
+ ok(HIWORD(len)==0, "Unexpected end position for selection %d\n",
HIWORD(len));
+ SendMessage(hParent, WM_SETFOCUS, 0, (LPARAM)hWnd);
+ len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
+ ok(LOWORD(len)==0, "Unexpected start position for selection %d\n",
LOWORD(len));
+ ok(HIWORD(len)==0, "Unexpected end position for selection %d\n",
HIWORD(len));
SendMessageA(hWnd, EM_SETLIMITTEXT, 5, 0);
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] Sun Feb 21 04:11:32 2010
@@ -44,7 +44,7 @@
*
*/
-#define _WIN32_WINNT 0x500
+#define _WIN32_WINNT 0x401
#define _WIN32_IE 0x0500
#include <stdarg.h>
Modified: trunk/rostests/winetests/user32/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/menu.c?r…
==============================================================================
--- trunk/rostests/winetests/user32/menu.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/menu.c [iso-8859-1] Sun Feb 21 04:11:32 2010
@@ -1890,8 +1890,10 @@
{ INPUT_KEYBOARD, {{0}}, {'D', 0}, FALSE, FALSE },
{ INPUT_KEYBOARD, {{0}}, {VK_MENU, 'M', 'P', 0}, TRUE, FALSE },
{ INPUT_KEYBOARD, {{0}}, {'E', 0}, FALSE, FALSE },
-
- { INPUT_MOUSE, {{1, 2}, {0}}, {0}, TRUE, TRUE }, /* test 18 */
+ { INPUT_KEYBOARD, {{0}}, {VK_F10, 0}, TRUE, FALSE },
+ { INPUT_KEYBOARD, {{0}}, {VK_F10, 0}, FALSE, FALSE },
+
+ { INPUT_MOUSE, {{1, 2}, {0}}, {0}, TRUE, TRUE }, /* test 20 */
{ INPUT_MOUSE, {{1, 1}, {0}}, {0}, FALSE, FALSE },
{ INPUT_MOUSE, {{1, 0}, {0}}, {0}, TRUE, TRUE },
{ INPUT_MOUSE, {{1, 1}, {0}}, {0}, FALSE, FALSE },
Modified: trunk/rostests/winetests/user32/msg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/msg.c?re…
==============================================================================
--- trunk/rostests/winetests/user32/msg.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/msg.c [iso-8859-1] Sun Feb 21 04:11:32 2010
@@ -297,7 +297,7 @@
{ WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_STATECHANGED },
/* in the 1st MDI child */
{ WM_NCCALCSIZE, sent|wparam|defwinproc, 1 }, /* in the 1st MDI child */
{ WM_CHILDACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
- { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc,
SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
}, /* in the 1st MDI child */
+ { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc,
SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED }, /* in the 1st MDI child
*/
{ WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED }, /* in the 1st MDI child */
/* Lock redraw 2nd MDI child */
{ WM_SETREDRAW, sent|wparam|defwinproc, 0 }, /* in the 2nd MDI child */
@@ -306,7 +306,7 @@
{ WM_WINDOWPOSCHANGING, sent|wparam|defwinproc,
SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_STATECHANGED },/* in the 2nd MDI child
*/
{ WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },/* in the 2nd MDI child */
{ EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 }, /* in the 2nd MDI child */
- { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc,
SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
}, /* in the 2nd MDI child */
+ { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc,
SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
}, /* in the 2nd MDI child */
{ WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED }, /* in the 2nd MDI child */
{ EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in the 2nd MDI
child */
/* Redraw 2nd MDI child */
@@ -2475,7 +2475,7 @@
{ WM_GETMINMAXINFO, sent },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED
},
{ WM_NCCALCSIZE, sent|wparam, 1 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
{ WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
/* in MDI frame */
{ WM_WINDOWPOSCHANGING, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
@@ -2528,7 +2528,7 @@
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
{ WM_NCCALCSIZE, sent|wparam, 1 },
{ WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
/* in MDI frame */
{ WM_WINDOWPOSCHANGING, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
@@ -2550,7 +2550,7 @@
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED
},
{ WM_NCCALCSIZE, sent|wparam, 1 },
{ EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
{ WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
/* in MDI frame */
{ WM_WINDOWPOSCHANGING, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
@@ -2615,7 +2615,7 @@
{ WM_GETMINMAXINFO, sent },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED
},
{ WM_NCCALCSIZE, sent|wparam, 1 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
{ WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
/* in MDI frame */
@@ -2721,7 +2721,7 @@
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED
},
{ WM_GETMINMAXINFO, sent|defwinproc },
{ WM_NCCALCSIZE, sent|wparam, 1 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_STATECHANGED },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
/* in MDI frame */
@@ -2763,7 +2763,7 @@
{ WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_STATECHANGED },
{ WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
{ WM_CHILDACTIVATE, sent|defwinproc|wparam|lparam, 0, 0 },
- { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc,
SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc,
SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
/* restore the 2nd MDI child */
@@ -2774,7 +2774,7 @@
{ EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
- { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc,
SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc,
SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
{ WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
{ EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
@@ -3021,7 +3021,7 @@
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_SETFOCUS, sent|optional|defwinproc },
{ WM_MDIACTIVATE, sent|optional|defwinproc },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
/* in MDI frame */
{ WM_WINDOWPOSCHANGING, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
@@ -3136,7 +3136,7 @@
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
{ WM_NCCALCSIZE, sent|wparam, 1 },
{ WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
/* in MDI frame */
{ WM_WINDOWPOSCHANGING, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
@@ -3152,7 +3152,7 @@
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
{ WM_NCCALCSIZE, sent|wparam, 1 },
{ WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
/* in MDI frame */
{ WM_WINDOWPOSCHANGING, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
@@ -3169,7 +3169,7 @@
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED
},
{ WM_NCCALCSIZE, sent|wparam, 1 },
{ WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_NOCLIENTSIZE|SWP_STATECHANGED },
+ { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED
},
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
{ EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
@@ -3186,7 +3186,7 @@
{ HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
{ WM_WINDOWPOSCHANGING, sent|wparam,
SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_STATECHANGED },
{ WM_NCCALCSIZE, sent|wparam, 1 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOCLIENTSIZE|SWP_STATECHANGED },
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_STATECHANGED },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
{ WM_CHILDACTIVATE, sent|wparam|lparam|defwinproc, 0, 0 },
@@ -3203,7 +3203,7 @@
{ WM_NCCALCSIZE, sent|wparam, 1 },
{ EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
{ WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
- { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED
},
+ { WM_WINDOWPOSCHANGED, sent|wparam,
SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
/* in MDI frame */
{ WM_WINDOWPOSCHANGING, sent|wparam,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
@@ -3359,6 +3359,7 @@
CLIENTCREATESTRUCT client_cs;
HWND mdi_frame, mdi_child, mdi_child2, active_child;
BOOL zoomed;
+ RECT rc;
HMENU hMenu = CreateMenu();
assert(mdi_RegisterWindowClasses());
@@ -3379,12 +3380,13 @@
ok(GetFocus() == mdi_frame, "wrong focus window %p\n", GetFocus());
trace("creating MDI client window\n");
+ GetClientRect(mdi_frame, &rc);
client_cs.hWindowMenu = 0;
client_cs.idFirstChild = MDI_FIRST_CHILD_ID;
mdi_client = CreateWindowExA(0, "MDI_client_class",
NULL,
WS_CHILD | WS_VISIBLE | MDIS_ALLCHILDSTYLES,
- 0, 0, 0, 0,
+ rc.left, rc.top, rc.right - rc.left, rc.bottom -
rc.top,
mdi_frame, 0, GetModuleHandleA(0), &client_cs);
assert(mdi_client);
ok_sequence(WmCreateMDIclientSeq, "Create visible MDI client window",
FALSE);
@@ -3570,7 +3572,7 @@
flush_sequence();
ShowWindow(mdi_child2, SW_RESTORE);
- ok_sequence(WmRestoreMDIchildVisibleSeq_2, "ShowWindow(SW_RESTORE):minimized MDI
child", TRUE);
+ ok_sequence(WmRestoreMDIchildVisibleSeq_2, "ShowWindow(SW_RESTORE):minimized MDI
child", FALSE);
ok(GetActiveWindow() == mdi_frame, "wrong active window %p\n",
GetActiveWindow());
ok(GetFocus() == mdi_child2, "wrong focus window %p\n", GetFocus());
@@ -6903,6 +6905,32 @@
{ WM_SYSKEYUP, sent|wparam|lparam, VK_F10, 0xc0000001 },
{ 0 }
};
+static const struct message WmShiftF10Seq[] = {
+ { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_SHIFT, 1 }, /* XP */
+ { WM_KEYDOWN, wparam|lparam, VK_SHIFT, 1 },
+ { WM_KEYDOWN, sent|wparam|lparam, VK_SHIFT, 0x00000001 },
+ { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F10, 1 }, /* XP */
+ { WM_SYSKEYDOWN, wparam|lparam, VK_F10, 1 },
+ { WM_SYSKEYDOWN, sent|wparam|lparam, VK_F10, 0x00000001 },
+ { WM_CONTEXTMENU, sent|defwinproc|lparam, /*hwnd*/0, -1 },
+ { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F10, 0xc0000001 }, /* XP */
+ { WM_SYSKEYUP, wparam|lparam, VK_F10, 0xc0000001 },
+ { WM_SYSKEYUP, sent|wparam|lparam, VK_F10, 0xc0000001 },
+ { WM_SYSCOMMAND, sent|defwinproc|wparam, SC_KEYMENU },
+ { HCBT_SYSCOMMAND, hook },
+ { WM_ENTERMENULOOP, sent|defwinproc|wparam|lparam, 0, 0 },
+ { WM_INITMENU, sent|defwinproc },
+ { WM_MENUSELECT, sent|defwinproc|wparam, MAKEWPARAM(0,MF_SYSMENU|MF_POPUP|MF_HILITE)
},
+ { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_SHIFT, 0xd0000001 }, /* XP */
+ { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_ESCAPE, 0x10000001 }, /* XP */
+ { WM_CAPTURECHANGED, sent|defwinproc|wparam|lparam, 0, 0 },
+ { WM_MENUSELECT, sent|defwinproc|wparam|lparam, 0xffff0000, 0 },
+ { WM_EXITMENULOOP, sent|defwinproc|wparam|lparam, 0, 0 },
+ { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_ESCAPE, 0xc0000001 }, /* XP */
+ { WM_KEYUP, wparam|lparam, VK_ESCAPE, 0xc0000001 },
+ { WM_KEYUP, sent|wparam|lparam, VK_ESCAPE, 0xc0000001 },
+ { 0 }
+};
static void pump_msg_loop(HWND hwnd, HACCEL hAccel)
{
@@ -7122,6 +7150,16 @@
keybd_event(VK_F10, 0, KEYEVENTF_KEYUP, 0);
pump_msg_loop(hwnd, 0);
ok_sequence(WmVkF10Seq, "VK_F10 press/release", TRUE);
+
+ trace("testing SHIFT+F10 press/release\n");
+ keybd_event(VK_SHIFT, 0, 0, 0);
+ keybd_event(VK_F10, 0, 0, 0);
+ keybd_event(VK_F10, 0, KEYEVENTF_KEYUP, 0);
+ keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
+ keybd_event(VK_ESCAPE, 0, 0, 0);
+ keybd_event(VK_ESCAPE, 0, KEYEVENTF_KEYUP, 0);
+ pump_msg_loop(hwnd, 0);
+ ok_sequence(WmShiftF10Seq, "SHIFT+F10 press/release", TRUE);
trace("testing Shift+MouseButton press/release\n");
/* first, move mouse pointer inside of the window client area */
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] Sun Feb 21 04:11:32 2010
@@ -52,6 +52,7 @@
static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
static int (WINAPI *pGetWindowRgnBox)(HWND,LPRECT);
+static BOOL (WINAPI *pGetGUIThreadInfo)(DWORD, GUITHREADINFO*);
static BOOL test_lbuttondown_flag;
static HWND hwndMessage;
@@ -61,6 +62,8 @@
static const char* szAWRClass = "Winsize";
static HMENU hmenu;
static DWORD our_pid;
+
+static BOOL is_win9x = FALSE;
#define COUNTOF(arr) (sizeof(arr)/sizeof(arr[0]))
@@ -444,6 +447,17 @@
ret = SetParent( test, child );
ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop
);
check_parents( test, child, child, 0, 0, hwndMain, test );
+
+ if (!is_win9x)
+ {
+ ShowWindow( test, SW_SHOW );
+ ret = SetParent( test, test );
+ ok( ret == NULL, "SetParent return value %p expected %p\n", ret, NULL
);
+ ok( GetWindowLongA( test, GWL_STYLE ) & WS_VISIBLE, "window is not
visible after SetParent\n" );
+ check_parents( test, child, child, 0, 0, hwndMain, test );
+ }
+ else
+ win_skip( "Test crashes on Win9x/WinMe\n" );
DestroyWindow( test );
/* owned popup */
@@ -639,7 +653,6 @@
}
case WM_WINDOWPOSCHANGING:
{
- BOOL is_win9x = GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == 0;
WINDOWPOS *winpos = (WINDOWPOS *)lparam;
trace("main: WM_WINDOWPOSCHANGING %p after %p, x %d, y %d, cx %d, cy %d flags
%08x\n",
winpos->hwnd, winpos->hwndInsertAfter,
@@ -848,7 +861,6 @@
DWORD style, exstyle;
RECT rc_window, rc_client, rc;
BOOL menu;
- BOOL is_win9x = GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == 0;
LRESULT ret;
style = GetWindowLongA(hwnd, GWL_STYLE);
@@ -1032,9 +1044,9 @@
HWND hwnd1, hwnd2, hwnd3, hwnd4, hwnd5;
HWND shellWindow, nextWnd;
- if (!GetWindowLongW(GetDesktopWindow(), GWL_STYLE))
- {
- trace("Skipping shell window test on Win9x\n");
+ if (is_win9x)
+ {
+ win_skip("Skipping shell window test on Win9x\n");
return;
}
@@ -1899,7 +1911,6 @@
{
RECT orig_win_rc, rect;
LONG_PTR old_proc;
- BOOL is_win9x = GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == 0;
SetRect(&rect, 111, 222, 333, 444);
ok(!GetWindowRect(0, &rect), "GetWindowRect succeeded\n");
@@ -1962,7 +1973,6 @@
{
HWND child;
HMENU hMenu, ret;
- BOOL is_win9x = GetWindowLongPtrW(parent, GWLP_WNDPROC) == 0;
BOOL retok;
DWORD style;
@@ -2149,7 +2159,7 @@
/*trace("skipping next %p (%p)\n", test,
UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)));*/
test = GetWindow(test, GW_HWNDNEXT);
}
- ok_(file, line)(next == test, "expected next %p, got %p\n", next, test);
+ ok_(file, line)(next == test, "%p: expected next %p, got %p\n", hwnd, next,
test);
test = GetWindow(hwnd, GW_HWNDPREV);
/* skip foreign windows */
@@ -2161,13 +2171,14 @@
/*trace("skipping prev %p (%p)\n", test,
UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)));*/
test = GetWindow(test, GW_HWNDPREV);
}
- ok_(file, line)(prev == test, "expected prev %p, got %p\n", prev, test);
+ ok_(file, line)(prev == test, "%p: expected prev %p, got %p\n", hwnd, prev,
test);
test = GetWindow(hwnd, GW_OWNER);
- ok_(file, line)(owner == test, "expected owner %p, got %p\n", owner,
test);
+ ok_(file, line)(owner == test, "%p: expected owner %p, got %p\n", hwnd,
owner, test);
ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
- ok_(file, line)(!(ex_style & WS_EX_TOPMOST) == !topmost, "expected
%stopmost\n", topmost ? "" : "NOT ");
+ ok_(file, line)(!(ex_style & WS_EX_TOPMOST) == !topmost, "%p: expected
%stopmost\n",
+ hwnd, topmost ? "" : "NOT ");
}
static void test_popup_zorder(HWND hwnd_D, HWND hwnd_E)
@@ -2248,6 +2259,20 @@
check_z_order(hwnd_A, hwnd_D, 0, 0, TRUE);
#endif
+ /* make hwnd_C owned by a topmost window */
+ DestroyWindow( hwnd_C );
+ hwnd_C = CreateWindowEx(0, "MainWindowClass", NULL,
+ WS_POPUP,
+ 100, 100, 100, 100,
+ hwnd_A, 0, GetModuleHandle(0), NULL);
+ trace("hwnd_C %p\n", hwnd_C);
+ check_z_order(hwnd_E, 0, hwnd_D, 0, FALSE);
+ check_z_order(hwnd_D, hwnd_E, hwnd_F, 0, FALSE);
+ check_z_order(hwnd_F, hwnd_D, hwnd_B, 0, FALSE);
+ check_z_order(hwnd_B, hwnd_F, hwnd_A, hwnd_F, TRUE);
+ check_z_order(hwnd_A, hwnd_B, hwnd_C, 0, TRUE);
+ check_z_order(hwnd_C, hwnd_A, 0, hwnd_A, TRUE);
+
DestroyWindow(hwnd_A);
DestroyWindow(hwnd_B);
DestroyWindow(hwnd_C);
@@ -2265,7 +2290,7 @@
ok( GetRandomRgn( hdc, hrgn, SYSRGN ) != 0, "GetRandomRgn failed\n" );
GetWindowRect( hwnd, &win_rect );
GetRgnBox( hrgn, &rgn_rect );
- if (GetVersion() & 0x80000000)
+ if (is_win9x)
{
trace("win9x, mapping to screen coords\n");
MapWindowPoints( hwnd, 0, (POINT *)&rgn_rect, 2 );
@@ -2697,6 +2722,122 @@
ok (ret, "releasecapture did not return TRUE after second try.\n");
}
+static LRESULT CALLBACK test_capture_4_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
lParam)
+{
+ GUITHREADINFO gti;
+ HWND cap_wnd, cap_wnd2, set_cap_wnd;
+ BOOL status;
+ switch (msg)
+ {
+ case WM_CAPTURECHANGED:
+
+ /* now try to release capture from menu. this should fail */
+ if (pGetGUIThreadInfo)
+ {
+ memset(>i, 0, sizeof(GUITHREADINFO));
+ gti.cbSize = sizeof(GUITHREADINFO);
+ status = pGetGUIThreadInfo(GetCurrentThreadId(), >i);
+ ok(status, "GetGUIThreadInfo() failed!\n");
+ ok(gti.flags & GUI_INMENUMODE, "Thread info incorrect
(flags=%08X)!\n", gti.flags);
+ }
+ cap_wnd = GetCapture();
+
+ /* check that re-setting the capture for the menu fails */
+ set_cap_wnd = SetCapture(cap_wnd);
+ ok(!set_cap_wnd || broken(set_cap_wnd == cap_wnd), /* nt4 */
+ "SetCapture should have failed!\n");
+ if (set_cap_wnd)
+ {
+ DestroyWindow(hWnd);
+ break;
+ }
+
+ /* check that SetCapture fails for another window and that it does not touch
the error code */
+ set_cap_wnd = SetCapture(hWnd);
+ ok(!set_cap_wnd, "SetCapture should have failed!\n");
+
+ /* check that ReleaseCapture fails and does not touch the error code */
+ status = ReleaseCapture();
+ ok(!status, "ReleaseCapture should have failed!\n");
+
+ /* check that thread info did not change */
+ if (pGetGUIThreadInfo)
+ {
+ memset(>i, 0, sizeof(GUITHREADINFO));
+ gti.cbSize = sizeof(GUITHREADINFO);
+ status = pGetGUIThreadInfo(GetCurrentThreadId(), >i);
+ ok(status, "GetGUIThreadInfo() failed!\n");
+ ok(gti.flags & GUI_INMENUMODE, "Thread info incorrect
(flags=%08X)!\n", gti.flags);
+ }
+
+ /* verify that no capture change took place */
+ cap_wnd2 = GetCapture();
+ ok(cap_wnd2 == cap_wnd, "Capture changed!\n");
+
+ /* we are done. kill the window */
+ DestroyWindow(hWnd);
+ break;
+
+ default:
+ return( DefWindowProcA( hWnd, msg, wParam, lParam ) );
+ }
+ return 0;
+}
+
+/* Test that no-one can mess around with the current capture while a menu is open */
+static void test_capture_4(void)
+{
+ BOOL ret;
+ HMENU hmenu;
+ HWND hwnd;
+ WNDCLASSA wclass;
+ HINSTANCE hInstance = GetModuleHandleA( NULL );
+
+ if (!pGetGUIThreadInfo)
+ {
+ win_skip("GetGUIThreadInfo is not available\n");
+ return;
+ }
+ wclass.lpszClassName = "TestCapture4Class";
+ wclass.style = CS_HREDRAW | CS_VREDRAW;
+ wclass.lpfnWndProc = test_capture_4_proc;
+ wclass.hInstance = hInstance;
+ wclass.hIcon = LoadIconA( 0, IDI_APPLICATION );
+ wclass.hCursor = LoadCursorA( NULL, IDC_ARROW );
+ wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
+ wclass.lpszMenuName = 0;
+ wclass.cbClsExtra = 0;
+ wclass.cbWndExtra = 0;
+ assert (RegisterClassA( &wclass ));
+ assert (hwnd = CreateWindowA( wclass.lpszClassName, "MenuTest",
+ WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0,
+ 400, 200, NULL, NULL, hInstance, NULL) );
+ ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+ if (!hwnd) return;
+ hmenu = CreatePopupMenu();
+
+ ret = AppendMenuA( hmenu, MF_STRING, 1, "winetest2");
+ ok( ret, "AppendMenuA has failed!\n");
+
+ /* set main window to have initial capture */
+ SetCapture(hwnd);
+
+ if (is_win9x)
+ {
+ win_skip("TrackPopupMenu test crashes on Win9x/WinMe\n");
+ }
+ else
+ {
+ /* create popup (it will self-destruct) */
+ ret = TrackPopupMenu(hmenu, TPM_RETURNCMD, 100, 100, 0, hwnd, NULL);
+ ok( ret == 0, "TrackPopupMenu returned %d expected zero\n", ret);
+ }
+
+ /* clean up */
+ DestroyMenu(hmenu);
+ DestroyWindow(hwnd);
+}
+
/* PeekMessage wrapper that ignores the messages we don't care about */
static BOOL peek_message( MSG *msg )
{
@@ -2871,6 +3012,7 @@
if (msg.message == WM_TIMER || ignore_message(msg.message)) continue;
ok(msg.hwnd == popup && msg.message == WM_MOUSEMOVE,
"hwnd %p message %04x\n", msg.hwnd, msg.message);
+ DispatchMessage(&msg);
}
ret = peek_message(&msg);
ok( !ret, "message %04x available\n", msg.message);
@@ -3096,6 +3238,7 @@
BOOL ret;
HWND desktop = GetDesktopWindow();
HMENU hMenu;
+ /* FIXME: This detection is not correct as it also covers (all?) XP+ */
BOOL is_win9x = GetWindowLongPtrW(desktop, GWLP_WNDPROC) == 0;
HWND parent, child1, child2, child3, child4, sibling;
@@ -3156,6 +3299,8 @@
check_parents(child3, child2, child2, child2, 0, child2, parent);
check_parents(child4, desktop, child2, child2, child2, child4, parent);
}
+ else
+ skip("Win9x/WinMe crash\n");
hMenu = CreateMenu();
sibling = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
@@ -5790,8 +5935,13 @@
pGetMonitorInfoA = (void *)GetProcAddress( user32, "GetMonitorInfoA" );
pMonitorFromPoint = (void *)GetProcAddress( user32, "MonitorFromPoint" );
pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" );
+ pGetGUIThreadInfo = (void *)GetProcAddress( user32, "GetGUIThreadInfo" );
if (!RegisterWindowClasses()) assert(0);
+
+ SetLastError(0xdeafbeef);
+ GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC);
+ is_win9x = (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED);
hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
if (!hhook) win_skip( "Cannot set CBT hook, skipping some tests\n" );
@@ -5821,6 +5971,7 @@
test_capture_1();
test_capture_2();
test_capture_3(hwndMain, hwndMain2);
+ test_capture_4();
test_CreateWindow();
test_parent_owner();