sync shell32 with wine 1.1.24

svn path=/trunk/; revision=41611
This commit is contained in:
Christoph von Wittich 2009-06-25 14:39:01 +00:00
parent ff37974bba
commit c1b0f80304
2 changed files with 60 additions and 23 deletions

View file

@ -36,6 +36,7 @@ struct testwindow_info
{ {
HWND hwnd; HWND hwnd;
BOOL registered; BOOL registered;
BOOL to_be_deleted;
RECT desired_rect; RECT desired_rect;
UINT edge; UINT edge;
RECT allocated_rect; RECT allocated_rect;
@ -58,6 +59,12 @@ static void testwindow_setpos(HWND hwnd)
return; return;
} }
if (info->to_be_deleted)
{
win_skip("Some Win95 and NT4 systems send messages to removed taskbars\n");
return;
}
abd.cbSize = sizeof(abd); abd.cbSize = sizeof(abd);
abd.hWnd = hwnd; abd.hWnd = hwnd;
abd.uEdge = info->edge; abd.uEdge = info->edge;
@ -71,15 +78,15 @@ static void testwindow_setpos(HWND hwnd)
abd.rc.top = abd.rc.bottom - (info->desired_rect.bottom - info->desired_rect.top); abd.rc.top = abd.rc.bottom - (info->desired_rect.bottom - info->desired_rect.top);
break; break;
case ABE_LEFT: case ABE_LEFT:
ok(info->desired_rect.right == abd.rc.right, "ABM_QUERYPOS changed right of rect from %i to %i\n", info->desired_rect.top, abd.rc.top); ok(info->desired_rect.right == abd.rc.right, "ABM_QUERYPOS changed right of rect from %i to %i\n", info->desired_rect.right, abd.rc.right);
abd.rc.right = abd.rc.left + (info->desired_rect.right - info->desired_rect.left); abd.rc.right = abd.rc.left + (info->desired_rect.right - info->desired_rect.left);
break; break;
case ABE_RIGHT: case ABE_RIGHT:
ok(info->desired_rect.left == abd.rc.left, "ABM_QUERYPOS changed left of rect from %i to %i\n", info->desired_rect.top, abd.rc.top); ok(info->desired_rect.left == abd.rc.left, "ABM_QUERYPOS changed left of rect from %i to %i\n", info->desired_rect.left, abd.rc.left);
abd.rc.left = abd.rc.right - (info->desired_rect.right - info->desired_rect.left); abd.rc.left = abd.rc.right - (info->desired_rect.right - info->desired_rect.left);
break; break;
case ABE_TOP: case ABE_TOP:
ok(info->desired_rect.bottom == abd.rc.bottom, "ABM_QUERYPOS changed bottom of rect from %i to %i\n", info->desired_rect.top, abd.rc.top); ok(info->desired_rect.bottom == abd.rc.bottom, "ABM_QUERYPOS changed bottom of rect from %i to %i\n", info->desired_rect.bottom, abd.rc.bottom);
abd.rc.bottom = abd.rc.top + (info->desired_rect.bottom - info->desired_rect.top); abd.rc.bottom = abd.rc.top + (info->desired_rect.bottom - info->desired_rect.top);
break; break;
} }
@ -221,6 +228,7 @@ static void test_setpos(void)
/* dock windows[0] to the bottom of the screen */ /* dock windows[0] to the bottom of the screen */
windows[0].registered = TRUE; windows[0].registered = TRUE;
windows[0].to_be_deleted = FALSE;
windows[0].edge = ABE_BOTTOM; windows[0].edge = ABE_BOTTOM;
windows[0].desired_rect.left = 0; windows[0].desired_rect.left = 0;
windows[0].desired_rect.right = screen_width; windows[0].desired_rect.right = screen_width;
@ -241,6 +249,7 @@ static void test_setpos(void)
/* dock windows[1] to the bottom of the screen */ /* dock windows[1] to the bottom of the screen */
windows[1].registered = TRUE; windows[1].registered = TRUE;
windows[1].to_be_deleted = FALSE;
windows[1].edge = ABE_BOTTOM; windows[1].edge = ABE_BOTTOM;
windows[1].desired_rect.left = 0; windows[1].desired_rect.left = 0;
windows[1].desired_rect.right = screen_width; windows[1].desired_rect.right = screen_width;
@ -272,6 +281,7 @@ static void test_setpos(void)
/* dock windows[2] to the bottom of the screen */ /* dock windows[2] to the bottom of the screen */
windows[2].registered = TRUE; windows[2].registered = TRUE;
windows[2].to_be_deleted = FALSE;
windows[2].edge = ABE_BOTTOM; windows[2].edge = ABE_BOTTOM;
windows[2].desired_rect.left = 0; windows[2].desired_rect.left = 0;
windows[2].desired_rect.right = screen_width; windows[2].desired_rect.right = screen_width;
@ -328,6 +338,7 @@ static void test_setpos(void)
expected_bottom = max(windows[0].allocated_rect.bottom, windows[1].allocated_rect.bottom); expected_bottom = max(windows[0].allocated_rect.bottom, windows[1].allocated_rect.bottom);
abd.hWnd = windows[0].hwnd; abd.hWnd = windows[0].hwnd;
windows[0].to_be_deleted = TRUE;
ret = SHAppBarMessage(ABM_REMOVE, &abd); ret = SHAppBarMessage(ABM_REMOVE, &abd);
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret); ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
windows[0].registered = FALSE; windows[0].registered = FALSE;
@ -341,12 +352,14 @@ static void test_setpos(void)
/* remove the other windows */ /* remove the other windows */
abd.hWnd = windows[1].hwnd; abd.hWnd = windows[1].hwnd;
windows[1].to_be_deleted = TRUE;
ret = SHAppBarMessage(ABM_REMOVE, &abd); ret = SHAppBarMessage(ABM_REMOVE, &abd);
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret); ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
windows[1].registered = FALSE; windows[1].registered = FALSE;
DestroyWindow(windows[1].hwnd); DestroyWindow(windows[1].hwnd);
abd.hWnd = windows[2].hwnd; abd.hWnd = windows[2].hwnd;
windows[2].to_be_deleted = TRUE;
ret = SHAppBarMessage(ABM_REMOVE, &abd); ret = SHAppBarMessage(ABM_REMOVE, &abd);
ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret); ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
windows[2].registered = FALSE; windows[2].registered = FALSE;
@ -399,7 +412,9 @@ static void test_appbarget(void)
if(ret) if(ret)
{ {
ok(abd.hWnd == (HWND)0xcccccccc, "hWnd overwritten\n"); ok(abd.hWnd == (HWND)0xcccccccc, "hWnd overwritten\n");
ok(abd.uEdge <= ABE_BOTTOM, "uEdge not returned\n"); ok(abd.uEdge <= ABE_BOTTOM ||
broken(abd.uEdge == 0xcccccccc), /* Some Win95 and NT4 */
"uEdge not returned\n");
ok(abd.rc.left != 0xcccccccc, "rc not updated\n"); ok(abd.rc.left != 0xcccccccc, "rc not updated\n");
} }

View file

@ -81,6 +81,15 @@ static void init_function_pointers(void)
ok(hr == S_OK, "SHGetMalloc failed %08x\n", hr); ok(hr == S_OK, "SHGetMalloc failed %08x\n", hr);
} }
static const char *wine_dbgstr_w(LPCWSTR str)
{
static char buf[512];
if (!str)
return "(null)";
WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
return buf;
}
static void test_ParseDisplayName(void) static void test_ParseDisplayName(void)
{ {
HRESULT hr; HRESULT hr;
@ -265,13 +274,15 @@ static void test_EnumObjects(IShellFolder *iFolder)
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
SFGAOF flags; SFGAOF flags;
#define SFGAO_VISTA SFGAO_DROPTARGET | SFGAO_CANLINK | SFGAO_CANCOPY
/* Native returns all flags no matter what we ask for */ /* Native returns all flags no matter what we ask for */
flags = SFGAO_CANCOPY; flags = SFGAO_CANCOPY;
hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags); hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags);
flags &= SFGAO_testfor; flags &= SFGAO_testfor;
ok(hr == S_OK, "GetAttributesOf returns %08x\n", hr); ok(hr == S_OK, "GetAttributesOf returns %08x\n", hr);
ok(flags == (attrs[i]) || ok(flags == (attrs[i]) ||
flags == (attrs[i] & ~SFGAO_FILESYSANCESTOR), /* Win9x, NT4 */ flags == (attrs[i] & ~SFGAO_FILESYSANCESTOR) || /* Win9x, NT4 */
flags == ((attrs[i] & ~SFGAO_CAPABILITYMASK) | SFGAO_VISTA), /* Vista and higher */
"GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]); "GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]);
flags = SFGAO_testfor; flags = SFGAO_testfor;
@ -469,7 +480,8 @@ static void test_GetDisplayName(void)
} }
/* WinXP and up store the filenames as both ANSI and UNICODE in the pidls */ /* WinXP and up store the filenames as both ANSI and UNICODE in the pidls */
if (pidlLast->mkid.cb >= 76) { if (pidlLast->mkid.cb >= 76) {
ok(!lstrcmpW((WCHAR*)&pidlLast->mkid.abID[46], wszFileName), ok(!lstrcmpW((WCHAR*)&pidlLast->mkid.abID[46], wszFileName) ||
(pidlLast->mkid.cb >= 94 && !lstrcmpW((WCHAR*)&pidlLast->mkid.abID[64], wszFileName)), /* Vista */
"Filename should be stored as wchar-string at this position!\n"); "Filename should be stored as wchar-string at this position!\n");
} }
@ -478,6 +490,7 @@ static void test_GetDisplayName(void)
hr = IShellFolder_BindToObject(psfDesktop, pidlTestFile, NULL, &IID_IUnknown, (VOID**)&psfFile); hr = IShellFolder_BindToObject(psfDesktop, pidlTestFile, NULL, &IID_IUnknown, (VOID**)&psfFile);
todo_wine todo_wine
ok (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || ok (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
hr == E_NOTIMPL || /* Vista */
broken(SUCCEEDED(hr)), /* Win9x, W2K */ broken(SUCCEEDED(hr)), /* Win9x, W2K */
"hr = %08x\n", hr); "hr = %08x\n", hr);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
@ -960,7 +973,9 @@ static void test_SHGetPathFromIDList(void)
wszPath[1] = '\0'; wszPath[1] = '\0';
result = pSHGetPathFromIDListW(pidlMyComputer, wszPath); result = pSHGetPathFromIDListW(pidlMyComputer, wszPath);
ok (!result, "SHGetPathFromIDListW succeeded where it shouldn't!\n"); ok (!result, "SHGetPathFromIDListW succeeded where it shouldn't!\n");
ok (GetLastError()==0xdeadbeef, "SHGetPathFromIDListW shouldn't set last error! Last error: %u\n", GetLastError()); ok (GetLastError()==0xdeadbeef ||
GetLastError()==ERROR_SUCCESS, /* Vista and higher */
"Unexpected last error from SHGetPathFromIDListW: %u\n", GetLastError());
ok (!wszPath[0], "Expected empty path\n"); ok (!wszPath[0], "Expected empty path\n");
if (result) { if (result) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
@ -1116,6 +1131,10 @@ static HRESULT WINAPI InitPropertyBag_IPropertyBag_Read(IPropertyBag *iface, LPC
'A','t','t','r','i','b','u','t','e','s',0 }; 'A','t','t','r','i','b','u','t','e','s',0 };
static const WCHAR wszResolveLinkFlags[] = { static const WCHAR wszResolveLinkFlags[] = {
'R','e','s','o','l','v','e','L','i','n','k','F','l','a','g','s',0 }; 'R','e','s','o','l','v','e','L','i','n','k','F','l','a','g','s',0 };
static const WCHAR wszTargetKnownFolder[] = {
'T','a','r','g','e','t','K','n','o','w','n','F','o','l','d','e','r',0 };
static const WCHAR wszCLSID[] = {
'C','L','S','I','D',0 };
if (!lstrcmpW(pszPropName, wszTargetSpecialFolder)) { if (!lstrcmpW(pszPropName, wszTargetSpecialFolder)) {
ok(V_VT(pVar) == VT_I4 || ok(V_VT(pVar) == VT_I4 ||
@ -1155,7 +1174,19 @@ static HRESULT WINAPI InitPropertyBag_IPropertyBag_Read(IPropertyBag *iface, LPC
return S_OK; return S_OK;
} }
ok(FALSE, "PropertyBag was asked for unknown property (vt=%d)!\n", V_VT(pVar)); if (!lstrcmpW(pszPropName, wszTargetKnownFolder)) {
ok(V_VT(pVar) == VT_BSTR, "Wrong variant type for 'TargetKnownFolder' property!\n");
/* TODO */
return E_INVALIDARG;
}
if (!lstrcmpW(pszPropName, wszCLSID)) {
ok(V_VT(pVar) == VT_EMPTY, "Wrong variant type for 'CLSID' property!\n");
/* TODO */
return E_INVALIDARG;
}
ok(FALSE, "PropertyBag was asked for unknown property %s (vt=%d)!\n", wine_dbgstr_w(pszPropName), V_VT(pVar));
return E_INVALIDARG; return E_INVALIDARG;
} }
@ -1529,7 +1560,7 @@ static void testSHGetFolderPathAndSubDirA(void)
static char toolongpath[MAX_PATH+1]; static char toolongpath[MAX_PATH+1];
if(!pSHGetFolderPathA) { if(!pSHGetFolderPathA) {
skip("SHGetFolderPathA not present!\n"); win_skip("SHGetFolderPathA not present!\n");
return; return;
} }
if(FAILED(pSHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata))) if(FAILED(pSHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata)))
@ -1551,16 +1582,13 @@ static void testSHGetFolderPathAndSubDirA(void)
skip("RemoveDirectoryA(%s) failed with error %u\n", testpath, GetLastError()); skip("RemoveDirectoryA(%s) failed with error %u\n", testpath, GetLastError());
return; return;
} }
for(i=0; i< MAX_PATH; i++)
toolongpath[i] = '0' + i % 10;
toolongpath[MAX_PATH] = '\0';
/* test invalid second parameter */ /* test invalid second parameter */
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | 0xff, NULL, SHGFP_TYPE_CURRENT, wine, testpath); ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | 0xff, NULL, SHGFP_TYPE_CURRENT, wine, testpath);
ok(E_INVALIDARG == ret, "expected E_INVALIDARG, got %x\n", ret); ok(E_INVALIDARG == ret, "expected E_INVALIDARG, got %x\n", ret);
/* test invalid forth parameter */ /* test fourth parameter */
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, wine, testpath); ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, winetemp, testpath);
switch(ret) { switch(ret) {
case S_OK: /* winvista */ case S_OK: /* winvista */
ok(!strncmp(appdata, testpath, strlen(appdata)), ok(!strncmp(appdata, testpath, strlen(appdata)),
@ -1590,6 +1618,9 @@ static void testSHGetFolderPathAndSubDirA(void)
ok(S_OK == ret, "expected S_OK, got %x\n", ret); ok(S_OK == ret, "expected S_OK, got %x\n", ret);
ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath); ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath);
for(i=0; i< MAX_PATH; i++)
toolongpath[i] = '0' + i % 10;
toolongpath[MAX_PATH] = '\0';
ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, toolongpath, testpath); ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, toolongpath, testpath);
ok(HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) == ret, ok(HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) == ret,
"expected %x, got %x\n", HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), ret); "expected %x, got %x\n", HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), ret);
@ -1622,15 +1653,6 @@ static void testSHGetFolderPathAndSubDirA(void)
RemoveDirectoryA(testpath); RemoveDirectoryA(testpath);
} }
static const char *wine_dbgstr_w(LPCWSTR str)
{
static char buf[512];
if (!str)
return "(null)";
WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
return buf;
}
static void test_LocalizedNames(void) static void test_LocalizedNames(void)
{ {
static char cCurrDirA[MAX_PATH]; static char cCurrDirA[MAX_PATH];