[WineTests] - Sync to 1.5.12.

svn path=/trunk/; revision=57232
This commit is contained in:
James Tabor 2012-09-04 02:13:48 +00:00
parent dae657d1a1
commit 7a2e4c733b
10 changed files with 441 additions and 21 deletions

View file

@ -66,6 +66,7 @@ static void test_ClipboardOwner(void)
ok( ret, "CloseClipboard error %d\n", GetLastError());
ok(OpenClipboard(hWnd1), "OpenClipboard failed\n");
todo_wine ok(OpenClipboard(hWnd1), "OpenClipboard second time in the same hwnd failed\n");
SetLastError(0xdeadbeef);
ret = OpenClipboard(hWnd2);

View file

@ -406,6 +406,56 @@ static void test_begin_paint(void)
"clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
}
/* test ScrollWindow with window DCs */
static void test_scroll_window(void)
{
PAINTSTRUCT ps;
HDC hdc;
RECT clip, rect;
/* ScrollWindow uses the window DC, ScrollWindowEx doesn't */
UpdateWindow( hwnd_owndc );
SetRect( &clip, 25, 25, 50, 50 );
ScrollWindow( hwnd_owndc, -5, -10, NULL, &clip );
hdc = BeginPaint( hwnd_owndc, &ps );
SetRectEmpty( &rect );
GetClipBox( hdc, &rect );
ok( rect.left >= 25 && rect.top >= 25 && rect.right <= 50 && rect.bottom <= 50,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
EndPaint( hwnd_owndc, &ps );
SetViewportExtEx( hdc, 2, 3, NULL );
SetViewportOrgEx( hdc, 30, 20, NULL );
ScrollWindow( hwnd_owndc, -5, -10, NULL, &clip );
hdc = BeginPaint( hwnd_owndc, &ps );
SetRectEmpty( &rect );
GetClipBox( hdc, &rect );
ok( rect.left >= 25 && rect.top >= 25 && rect.right <= 50 && rect.bottom <= 50,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
EndPaint( hwnd_owndc, &ps );
ScrollWindowEx( hwnd_owndc, -5, -10, NULL, &clip, 0, NULL, SW_INVALIDATE | SW_ERASE );
hdc = BeginPaint( hwnd_owndc, &ps );
SetRectEmpty( &rect );
GetClipBox( hdc, &rect );
ok( rect.left >= -5 && rect.top >= 5 && rect.right <= 20 && rect.bottom <= 30,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
EndPaint( hwnd_owndc, &ps );
SetViewportExtEx( hdc, 1, 1, NULL );
SetViewportOrgEx( hdc, 0, 0, NULL );
ScrollWindowEx( hwnd_owndc, -5, -10, NULL, &clip, 0, NULL, SW_INVALIDATE | SW_ERASE );
hdc = BeginPaint( hwnd_owndc, &ps );
SetRectEmpty( &rect );
GetClipBox( hdc, &rect );
ok( rect.left >= 25 && rect.top >= 25 && rect.right <= 50 && rect.bottom <= 50,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
EndPaint( hwnd_owndc, &ps );
}
static void test_invisible_create(void)
{
HWND hwnd_owndc = CreateWindowA("owndc_class", NULL, WS_OVERLAPPED,
@ -559,6 +609,7 @@ START_TEST(dce)
test_parameters();
test_dc_visrgn();
test_begin_paint();
test_scroll_window();
test_invisible_create();
test_dc_layout();

View file

@ -1924,7 +1924,7 @@ static void test_DdeCreateDataHandle(void)
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
ret = DdeUninitialize(dde_inst2);
ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
/* NULL pSrc */
@ -2037,7 +2037,7 @@ static void test_DdeCreateDataHandle(void)
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ret = DdeUninitialize(dde_inst);
ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
}
static void test_DdeCreateStringHandle(void)
@ -2460,7 +2460,6 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
ok(!lstrcmpA(str, test_topic), "Expected %s, got %s, msg_index=%d\n",
test_topic, str, msg_index);
ok(size == 12, "Expected 12, got %d, msg_index=%d\n", size, msg_index);
ok(size == 12, "Expected 12, got %d, msg_index=%d\n", size, msg_index);
size = DdeGetData(hdata, NULL, 0, 0);
ok((buffer = HeapAlloc(GetProcessHeap(), 0, size)) != NULL, "should not be null\n");

View file

@ -39,12 +39,14 @@ struct edit_notify {
static struct edit_notify notifications;
static BOOL (WINAPI *pEndMenu) (void);
static BOOL (WINAPI *pGetMenuBarInfo)(HWND,LONG,LONG,PMENUBARINFO);
static void init_function_pointers(void)
{
HMODULE hdll = GetModuleHandleA("user32");
pEndMenu = (void*)GetProcAddress(hdll, "EndMenu");
pGetMenuBarInfo = (void*)GetProcAddress(hdll, "GetMenuBarInfo");
}
static INT_PTR CALLBACK multi_edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
@ -2134,6 +2136,7 @@ static void test_child_edit_wmkeydown(void)
static int got_en_setfocus = 0;
static int got_wm_capturechanged = 0;
static LRESULT (CALLBACK *p_edit_proc)(HWND, UINT, WPARAM, LPARAM);
static LRESULT CALLBACK edit4_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@ -2156,7 +2159,50 @@ static LRESULT CALLBACK edit4_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPAR
return DefWindowProcA(hWnd, msg, wParam, lParam);
}
static void test_contextmenu_focus(void)
static LRESULT CALLBACK edit_proc_proxy(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_ENTERIDLE: {
MENUBARINFO mbi;
BOOL ret;
HWND ctx_menu = (HWND)lParam;
memset(&mbi, 0, sizeof(mbi));
mbi.cbSize = sizeof(mbi);
SetLastError(0xdeadbeef);
ret = pGetMenuBarInfo(ctx_menu, OBJID_CLIENT, 0, &mbi);
ok(ret || broken(!ret && GetLastError()==ERROR_INVALID_WINDOW_HANDLE) /* NT */,
"GetMenuBarInfo failed\n");
if (ret)
{
ok(mbi.hMenu != NULL, "mbi.hMenu = NULL\n");
ok(!mbi.hwndMenu, "mbi.hwndMenu != NULL\n");
ok(mbi.fBarFocused, "mbi.fBarFocused = FALSE\n");
ok(mbi.fFocused, "mbi.fFocused = FALSE\n");
}
memset(&mbi, 0, sizeof(mbi));
mbi.cbSize = sizeof(mbi);
SetLastError(0xdeadbeef);
ret = pGetMenuBarInfo(ctx_menu, OBJID_CLIENT, 1, &mbi);
ok(ret || broken(!ret && GetLastError()==ERROR_INVALID_WINDOW_HANDLE) /* NT */,
"GetMenuBarInfo failed\n");
if (ret)
{
ok(mbi.hMenu != NULL, "mbi.hMenu = NULL\n");
ok(!mbi.hwndMenu, "mbi.hwndMenu != NULL\n");
ok(mbi.fBarFocused, "mbi.fBarFocused = FALSE\n");
ok(!mbi.fFocused, "mbi.fFocused = TRUE\n");
}
pEndMenu();
break;
}
}
return p_edit_proc(hWnd, msg, wParam, lParam);
}
static void test_contextmenu(void)
{
HWND hwndMain, hwndEdit;
@ -2171,15 +2217,17 @@ static void test_contextmenu_focus(void)
assert(hwndEdit);
SetFocus(NULL);
SetCapture(hwndMain);
SendMessage(hwndEdit, WM_CONTEXTMENU, (WPARAM)hwndEdit, MAKEWORD(10, 10));
ok(got_en_setfocus, "edit box didn't get focused\n");
ok(got_wm_capturechanged, "main window capture did not change\n");
if (pGetMenuBarInfo)
{
p_edit_proc = (void*)SetWindowLongPtr(hwndEdit, GWLP_WNDPROC, (ULONG_PTR)edit_proc_proxy);
SendMessage(hwndEdit, WM_CONTEXTMENU, (WPARAM)hwndEdit, MAKEWORD(10, 10));
}
DestroyWindow (hwndEdit);
DestroyWindow (hwndMain);
}
@ -2516,7 +2564,7 @@ START_TEST(edit)
test_fontsize();
test_dialogmode();
if (pEndMenu)
test_contextmenu_focus();
test_contextmenu();
else
win_skip("EndMenu is not available\n");

View file

@ -1335,7 +1335,6 @@ static void test_listbox_dlgdir(void)
ok (itemCount == itemCount_justDrives + itemCount_allDirs,
"DlgDirList() incorrectly filled the listbox!\n");
/* Now test DlgDirSelectEx() in normal operation */
/* Fill with everything - drives, directory and all plain files. */
strcpy(pathBuffer, "*");
@ -1412,6 +1411,8 @@ static void test_listbox_dlgdir(void)
}
}
DeleteFileA( "wtest1.tmp.c" );
/* Now test DlgDirSelectEx() in abnormal operation */
/* Fill list with bogus entries, that look somewhat valid */
SendMessage(g_listBox, LB_RESETCONTENT, 0, 0);
@ -1472,9 +1473,29 @@ static void test_listbox_dlgdir(void)
ok (!strcmp(pathBuffer, tempBuffer), "Formatted file should be %s, got %s\n", tempBuffer, pathBuffer);
}
}
DestroyWindow(hWnd);
DeleteFileA( "wtest1.tmp.c" );
/* Test behavior when loading folders from root with and without wildcard */
strcpy(pathBuffer, "C:\\");
res = DlgDirList(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
ok(res || broken(!res) /* NT4/W2K */, "DlgDirList failed to list C:\\ folders\n");
todo_wine ok(!strcmp(pathBuffer, "*") || broken(!res) /* NT4/W2K */,
"DlgDirList set the invalid path spec '%s', expected '*'\n", pathBuffer);
strcpy(pathBuffer, "C:\\*");
res = DlgDirList(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
ok(res || broken(!res) /* NT4/W2K */, "DlgDirList failed to list C:\\* folders\n");
ok(!strcmp(pathBuffer, "*") || broken(!res) /* NT4/W2K */,
"DlgDirList set the invalid path spec '%s', expected '*'\n", pathBuffer);
/* Try loading files from an invalid folder */
SetLastError(0xdeadbeef);
strcpy(pathBuffer, "C:\\INVALID$$DIR");
res = DlgDirList(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
todo_wine ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
todo_wine ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
"GetLastError should return 0x589, got 0x%X\n",GetLastError());
DestroyWindow(hWnd);
}
START_TEST(listbox)

View file

@ -38,6 +38,7 @@
static ATOM atomMenuCheckClass;
static BOOL (WINAPI *pGetMenuInfo)(HMENU,LPCMENUINFO);
static BOOL (WINAPI *pGetMenuBarInfo)(HWND,LONG,LONG,PMENUBARINFO);
static UINT (WINAPI *pSendInput)(UINT, INPUT*, size_t);
static BOOL (WINAPI *pSetMenuInfo)(HMENU,LPCMENUINFO);
static BOOL (WINAPI *pEndMenu) (void);
@ -52,6 +53,7 @@ static void init_function_pointers(void)
trace("GetProcAddress(%s) failed\n", #func);
GET_PROC(GetMenuInfo)
GET_PROC(GetMenuBarInfo)
GET_PROC(SendInput)
GET_PROC(SetMenuInfo)
GET_PROC(EndMenu)
@ -116,6 +118,7 @@ typedef struct
/* globals to communicate between test and wndproc */
static BOOL bMenuVisible;
static INT popmenu;
static BOOL got_input;
static HMENU hMenus[4];
@ -267,6 +270,134 @@ static void register_menu_check_class(void)
atomMenuCheckClass = RegisterClass(&wc);
}
static void test_getmenubarinfo(void)
{
BOOL ret;
HMENU hmenu;
MENUBARINFO mbi;
RECT rcw, rci;
HWND hwnd;
INT err;
if (!pGetMenuBarInfo) {
win_skip("GetMenuBarInfo is not available\n");
return;
}
mbi.cbSize = sizeof(MENUBARINFO);
hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL,
WS_SYSMENU | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
/* no menu: getmenubarinfo should fail */
SetLastError(0xdeadbeef);
ret = pGetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
err = GetLastError();
ok(ret == FALSE, "GetMenuBarInfo should not have been successful\n");
ok(err == 0xdeadbeef, "err = %d\n", err);
/* create menubar, no items yet */
hmenu = CreateMenu();
ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
ret = SetMenu(hwnd, hmenu);
ok(ret, "SetMenu failed with error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pGetMenuBarInfo(NULL, OBJID_CLIENT, 0, &mbi);
err = GetLastError();
ok(!ret, "GetMenuBarInfo succeeded\n");
ok(err == ERROR_INVALID_WINDOW_HANDLE, "err = %d\n", err);
SetLastError(0xdeadbeef);
ret = pGetMenuBarInfo(hwnd, OBJID_CLIENT, 0, &mbi);
err = GetLastError();
ok(!ret, "GetMenuBarInfo succeeded\n");
ok(err==ERROR_INVALID_MENU_HANDLE || broken(err==0xdeadbeef) /* NT, W2K, XP */, "err = %d\n", err);
SetLastError(0xdeadbeef);
ret = pGetMenuBarInfo(hwnd, OBJID_MENU, -1, &mbi);
err = GetLastError();
ok(ret == FALSE, "GetMenuBarInfo should have failed\n");
ok(err == 0xdeadbeef, "err = %d\n", err);
mbi.cbSize = 1000;
SetLastError(0xdeadbeef);
ret = pGetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
err = GetLastError();
ok(ret == FALSE, "GetMenuBarInfo should have failed\n");
ok(err == ERROR_INVALID_PARAMETER, "err = %d\n", err);
mbi.cbSize = sizeof(MENUBARINFO);
SetLastError(0xdeadbeef);
ret = pGetMenuBarInfo(hwnd, 123, 0, &mbi);
err = GetLastError();
ok(ret == FALSE, "GetMenuBarInfo should have failed\n");
ok(err == 0xdeadbeef, "err = %d\n", err);
ret = pGetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError());
ok(mbi.rcBar.left == 0 && mbi.rcBar.top == 0 &&
mbi.rcBar.bottom == 0 && mbi.rcBar.right == 0,
"rcBar: Expected 0,0-0,0, got: %d,%d-%d,%d\n",
mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom);
ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n",
mbi.hMenu, hmenu);
ok(mbi.fBarFocused == 0, "fBarFocused: Got %d instead of 0.\n", mbi.fBarFocused);
ok(mbi.fFocused == 0, "fFocused: Got %d instead of 0.\n", mbi.fFocused);
/* add some items */
ret = AppendMenu(hmenu, MF_STRING , 100, "item 1");
ok(ret, "AppendMenu failed.\n");
ret = AppendMenu(hmenu, MF_STRING , 101, "item 2");
ok(ret, "AppendMenu failed.\n");
ret = SetMenu(hwnd, hmenu);
ok(ret, "SetMenu failed with error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pGetMenuBarInfo(hwnd, OBJID_MENU, 200, &mbi);
err = GetLastError();
ok(ret == FALSE, "GetMenuBarInfo should have failed\n");
ok(err == 0xdeadbeef, "err = %d\n", err);
/* get info for the whole menu */
ret = pGetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError());
/* calculate menu rectangle, from window rectangle and the position of the first item */
ret = GetWindowRect(hwnd, &rcw);
ok(ret, "GetWindowRect failed.\n");
ret = GetMenuItemRect(hwnd, hmenu, 0, &rci);
ok(ret, "GetMenuItemRect failed.\n");
todo_wine ok(mbi.rcBar.left == rci.left && mbi.rcBar.top == rci.top &&
mbi.rcBar.bottom == rci.bottom && mbi.rcBar.right == rcw.right - rci.left + rcw.left,
"rcBar: Got %d,%d-%d,%d instead of %d,%d-%d,%d\n",
mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom,
rci.left, rci.top, rcw.right - rci.left + rcw.left, rci.bottom);
ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n", mbi.hMenu, hmenu);
ok(mbi.fBarFocused == 0, "fBarFocused: got %d instead of 0\n", mbi.fBarFocused);
ok(mbi.fFocused == 0, "fFocused: got %d instead of 0\n", mbi.fFocused);
/* get info for item nr.2 */
ret = pGetMenuBarInfo(hwnd, OBJID_MENU, 2, &mbi);
ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError());
ret = GetMenuItemRect(hwnd, hmenu, 1, &rci);
ok(ret, "GetMenuItemRect failed.\n");
ok(mbi.rcBar.left == rci.left && mbi.rcBar.top == rci.top &&
mbi.rcBar.bottom == rci.bottom && mbi.rcBar.right == rci.right,
"rcBar: Got %d,%d-%d,%d instead of %d,%d-%d,%d\n",
mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom,
rci.left, rci.top, rci.right, rci.bottom);
ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n", mbi.hMenu, hmenu);
ok(mbi.fBarFocused == 0, "fBarFocused: got %d instead of 0\n", mbi.fBarFocused);
ok(mbi.fFocused == 0, "fFocused: got %d instead of 0\n", mbi.fFocused);
DestroyWindow(hwnd);
}
/* demonstrates that windows locks the menu object so that it is still valid
* even after a client calls DestroyMenu on it */
static void test_menu_locked_by_window(void)
@ -2030,9 +2161,12 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_ENTERMENULOOP:
bMenuVisible = TRUE;
break;
case WM_INITMENUPOPUP:
case WM_UNINITMENUPOPUP:
case WM_EXITMENULOOP:
bMenuVisible = FALSE;
case WM_MENUSELECT:
break;
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_MOUSEMOVE:
@ -2046,6 +2180,59 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam,
default:
return( DefWindowProcA( hWnd, msg, wParam, lParam ) );
}
if(pGetMenuBarInfo)
{
MENUBARINFO mbi;
HMENU hmenu;
UINT state;
BOOL br;
mbi.cbSize = sizeof(MENUBARINFO);
/* get info for the menu */
br = pGetMenuBarInfo(hWnd, OBJID_MENU, 0, &mbi);
ok(br, "msg %x: GetMenuBarInfo failed\n", msg);
hmenu = GetMenu(hWnd);
ok(!mbi.hwndMenu, "msg %x: GetMenuBarInfo.hwndMenu wrong: %p expected NULL\n",
msg, mbi.hwndMenu);
ok(mbi.hMenu == hmenu, "msg %x: GetMenuBarInfo got wrong menu: %p expected %p\n",
msg, mbi.hMenu, hmenu);
ok(!bMenuVisible == !mbi.fBarFocused, "msg %x: GetMenuBarInfo.fBarFocused (%d) is wrong\n",
msg, mbi.fBarFocused != 0);
ok(!bMenuVisible == !mbi.fFocused, "msg %x: GetMenuBarInfo.fFocused (%d) is wrong\n",
msg, mbi.fFocused != 0);
/* get info for the menu's first item */
br = pGetMenuBarInfo(hWnd, OBJID_MENU, 1, &mbi);
ok(br, "msg %x: GetMenuBarInfo failed\n", msg);
state = GetMenuState(hmenu, 0, MF_BYPOSITION);
if (pGetMenuInfo) /* Skip on NT */
{
/* Native returns handle to destroyed window */
if (msg==WM_UNINITMENUPOPUP && popmenu==1)
todo_wine ok(!mbi.hwndMenu == !popmenu,
"msg %x: GetMenuBarInfo.hwndMenu wrong: %p expected %sNULL\n",
msg, mbi.hwndMenu, popmenu ? "not " : "");
else
ok(!mbi.hwndMenu == !popmenu,
"msg %x: GetMenuBarInfo.hwndMenu wrong: %p expected %sNULL\n",
msg, mbi.hwndMenu, popmenu ? "not " : "");
}
ok(mbi.hMenu == hmenu, "msg %x: GetMenuBarInfo got wrong menu: %p expected %p\n",
msg, mbi.hMenu, hmenu);
ok(!bMenuVisible == !mbi.fBarFocused, "nsg %x: GetMenuBarInfo.fBarFocused (%d) is wrong\n",
msg, mbi.fBarFocused != 0);
ok(!(bMenuVisible && (state & MF_HILITE)) == !mbi.fFocused,
"msg %x: GetMenuBarInfo.fFocused (%d) is wrong\n", msg, mbi.fFocused != 0);
}
if (msg == WM_EXITMENULOOP)
bMenuVisible = FALSE;
else if (msg == WM_INITMENUPOPUP)
popmenu++;
else if (msg == WM_UNINITMENUPOPUP)
popmenu--;
return 0;
}
@ -3317,6 +3504,7 @@ START_TEST(menu)
test_menu_locked_by_window();
test_subpopup_locked_by_menu();
test_menu_ownerdraw();
test_getmenubarinfo();
test_menu_bmp_and_string();
test_menu_getmenuinfo();
test_menu_setmenuinfo();

View file

@ -177,7 +177,7 @@ static void test_ChangeDisplaySettingsEx(void)
dm.dmDriverExtra = 1;
res = pChangeDisplaySettingsExA(NULL, &dm, NULL, CDS_TEST, NULL);
ok(res == DISP_CHANGE_SUCCESSFUL,
"ChangeDisplaySettingsExW returned %d, expected DISP_CHANGE_BADMODE\n", res);
"ChangeDisplaySettingsExW returned %d, expected DISP_CHANGE_SUCCESSFUL\n", res);
ok(dm.dmDriverExtra == 1, "ChangeDisplaySettingsExA shouldn't reset dmDriverExtra to 0\n");
memset(&dmW, 0, sizeof(dmW));
@ -201,7 +201,7 @@ static void test_ChangeDisplaySettingsEx(void)
if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
{
ok(res == DISP_CHANGE_SUCCESSFUL,
"ChangeDisplaySettingsExW returned %d, expected DISP_CHANGE_BADMODE\n", res);
"ChangeDisplaySettingsExW returned %d, expected DISP_CHANGE_SUCCESSFUL\n", res);
ok(dmW.dmDriverExtra == 1, "ChangeDisplaySettingsExW shouldn't reset dmDriverExtra to 0\n");
}

View file

@ -375,7 +375,7 @@ todo_wine
ret = EnableScrollBar( hwnd, SB_HORZ, ESB_ENABLE_BOTH);
ok( !ret, "Horizontal window scroll bar was not enabled\n");
DestroyWindow( hwnd);
/* finally, check if adding a WS_[HV]SColl style of a window makes the scroll info
/* finally, check if adding a WS_[HV]SCROLL style of a window makes the scroll info
* available */
if( style & (WS_HSCROLL | WS_VSCROLL)) return;/* only test if not yet set */
/* Start with a clean window */

View file

@ -1172,7 +1172,7 @@ static void test_shell_window(void)
ok(!ret, "third call to SetShellWindow(hwnd1)\n"); */
SetWindowLong(hwnd1, GWL_EXSTYLE, GetWindowLong(hwnd1,GWL_EXSTYLE)|WS_EX_TOPMOST);
ret = GetWindowLong(hwnd1,GWL_EXSTYLE)&WS_EX_TOPMOST? TRUE: FALSE;
ret = (GetWindowLong(hwnd1,GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
ok(!ret, "SetWindowExStyle(hwnd1, WS_EX_TOPMOST)\n");
ret = DestroyWindow(hwnd1);
@ -2157,6 +2157,14 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
DestroyWindow(hwnd_grandchild);
DestroyWindow(hwnd_child);
DestroyWindow(hwnd_child2);
hwnd_child = create_tool_window(WS_CHILD|WS_POPUP|WS_SYSMENU, hwnd2);
ok(!!hwnd_child, "Failed to create child window (%d)\n", GetLastError());
ret = SetWindowPos(hwnd_child, NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
ok(ret, "Got %d\n", ret);
flush_events( TRUE );
todo_wine check_active_state(hwnd2, hwnd2, hwnd2);
DestroyWindow(hwnd_child);
}
static void test_SetMenu(HWND parent)
@ -6680,7 +6688,7 @@ static void test_FlashWindowEx(void)
{
HWND hwnd;
FLASHWINFO finfo;
BOOL ret;
BOOL prev, ret;
if (!pFlashWindowEx)
{
@ -6749,8 +6757,7 @@ static void test_FlashWindowEx(void)
"FlashWindowEx returned with %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pFlashWindowEx(&finfo);
ok(ret, "previous window state should be active\n");
prev = pFlashWindowEx(&finfo);
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);
@ -6762,7 +6769,7 @@ static void test_FlashWindowEx(void)
SetLastError(0xdeadbeef);
ret = pFlashWindowEx(&finfo);
todo_wine
ok(!ret, "previous window state should not be active\n");
ok(prev != ret, "previous window state should be different\n");
DestroyWindow( hwnd );
}

View file

@ -371,6 +371,110 @@ static void test_enumdesktops(void)
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
}
/* Miscellaneous tests */
static void test_getuserobjectinformation(void)
{
HDESK desk;
WCHAR bufferW[20];
char buffer[20];
WCHAR foobarTestW[] = {'f','o','o','b','a','r','T','e','s','t',0};
WCHAR DesktopW[] = {'D','e','s','k','t','o','p',0};
DWORD size;
BOOL ret;
desk = CreateDesktop("foobarTest", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
ok(desk != 0, "open foobarTest desktop failed\n");
strcpy(buffer, "blahblah");
/** Tests for UOI_NAME **/
/* Get size, test size and return value/error code */
SetLastError(0xdeadbeef);
size = 0xdeadbeef;
ret = GetUserObjectInformationA(desk, UOI_NAME, NULL, 0, &size);
ok(!ret, "GetUserObjectInformationA returned %x\n", ret);
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError());
ok(size == 22, "size is set to %d\n", size); /* Windows returns Unicode length (11*2) */
/* Get string */
SetLastError(0xdeadbeef);
size = 0xdeadbeef;
ret = GetUserObjectInformationA(desk, UOI_NAME, buffer, sizeof(buffer), &size);
ok(ret, "GetUserObjectInformationA returned %x\n", ret);
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
ok(strcmp(buffer, "foobarTest") == 0, "Buffer is set to '%s'\n", buffer);
ok(size == 11, "size is set to %d\n", size); /* 11 bytes in 'foobarTest\0' */
/* Get size, test size and return value/error code (Unicode) */
SetLastError(0xdeadbeef);
size = 0xdeadbeef;
ret = GetUserObjectInformationW(desk, UOI_NAME, NULL, 0, &size);
ok(!ret, "GetUserObjectInformationW returned %x\n", ret);
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError());
ok(size == 22, "size is set to %d\n", size); /* 22 bytes in 'foobarTest\0' in Unicode */
/* Get string (Unicode) */
SetLastError(0xdeadbeef);
size = 0xdeadbeef;
ret = GetUserObjectInformationW(desk, UOI_NAME, bufferW, sizeof(bufferW), &size);
ok(ret, "GetUserObjectInformationW returned %x\n", ret);
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
ok(lstrcmpW(bufferW, foobarTestW) == 0, "Buffer is not set to 'foobarTest'\n");
ok(size == 22, "size is set to %d\n", size); /* 22 bytes in 'foobarTest\0' in Unicode */
/** Tests for UOI_TYPE **/
/* Get size, test size and return value/error code */
SetLastError(0xdeadbeef);
size = 0xdeadbeef;
ret = GetUserObjectInformationA(desk, UOI_TYPE, NULL, 0, &size);
ok(!ret, "GetUserObjectInformationA returned %x\n", ret);
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError());
ok(size == 16, "size is set to %d\n", size); /* Windows returns Unicode length (8*2) */
/* Get string */
SetLastError(0xdeadbeef);
size = 0xdeadbeef;
ret = GetUserObjectInformationA(desk, UOI_TYPE, buffer, sizeof(buffer), &size);
ok(ret, "GetUserObjectInformationA returned %x\n", ret);
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
ok(strcmp(buffer, "Desktop") == 0, "Buffer is set to '%s'\n", buffer);
ok(size == 8, "size is set to %d\n", size); /* 8 bytes in 'Desktop\0' */
/* Get size, test size and return value/error code (Unicode) */
size = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = GetUserObjectInformationW(desk, UOI_TYPE, NULL, 0, &size);
ok(!ret, "GetUserObjectInformationW returned %x\n", ret);
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError());
ok(size == 16, "size is set to %d\n", size); /* 16 bytes in 'Desktop\0' in Unicode */
/* Get string (Unicode) */
SetLastError(0xdeadbeef);
size = 0xdeadbeef;
ret = GetUserObjectInformationW(desk, UOI_TYPE, bufferW, sizeof(bufferW), &size);
ok(ret, "GetUserObjectInformationW returned %x\n", ret);
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
ok(lstrcmpW(bufferW, DesktopW) == 0, "Buffer is not set to 'Desktop'\n");
ok(size == 16, "size is set to %d\n", size); /* 16 bytes in 'Desktop\0' in Unicode */
ok(CloseDesktop(desk), "CloseDesktop failed\n");
}
START_TEST(winstation)
{
/* Check whether this platform supports WindowStation calls */
@ -386,4 +490,5 @@ START_TEST(winstation)
test_enumstations();
test_enumdesktops();
test_handles();
test_getuserobjectinformation();
}