From 17aeb550bf8c59fb7e68dda4ee1181fe3fe0b1f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mariusz=20Pluci=C5=84ski?= Date: Thu, 9 Jun 2011 10:40:44 +0200 Subject: [PATCH] shell32/tests: Basic tests of IKnownFolder. --- dlls/shell32/tests/shellpath.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 7e77b259942..2a1c4367a22 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -887,8 +887,15 @@ static void test_knownFolders(void) { HRESULT hr; IKnownFolderManager *mgr = NULL; + IKnownFolder *folder = NULL; KNOWNFOLDERID folderId; + KF_CATEGORY cat = 0; int csidl; + LPWSTR folderPath; + KF_REDIRECTION_CAPABILITIES redirectionCapabilities = 1; + WCHAR sWinDir[MAX_PATH]; + + GetWindowsDirectoryW( sWinDir, MAX_PATH ); CoInitialize(NULL); @@ -908,6 +915,38 @@ static void test_knownFolders(void) ok(hr == S_OK, "failed to convert CSIDL to KNOWNFOLDERID: 0x%08x\n", hr); ok(csidl == CSIDL_WINDOWS, "invalid CSIDL returned\n"); + hr = IKnownFolderManager_GetFolder(mgr, &FOLDERID_Windows, &folder); + ok(hr == S_OK, "failed to get known folder: 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + hr = IKnownFolder_GetCategory(folder, &cat); + todo_wine + ok(hr == S_OK, "failed to get folder category: 0x%08x\n", hr); + todo_wine + ok(cat==KF_CATEGORY_FIXED, "invalid folder category: %d\n", cat); + + hr = IKnownFolder_GetId(folder, &folderId); + ok(hr == S_OK, "failed to get folder id: 0x%08x\n", hr); + ok(IsEqualGUID(&folderId, &FOLDERID_Windows)==TRUE, "invalid KNOWNFOLDERID returned\n"); + + hr = IKnownFolder_GetPath(folder, 0, &folderPath); + ok(lstrcmpiW(sWinDir, folderPath)==0, "invalid path returned: \"%s\", expected: \"%s\"\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sWinDir)); + CoTaskMemFree(folderPath); + + hr = IKnownFolder_GetRedirectionCapabilities(folder, &redirectionCapabilities); + todo_wine + ok(hr == S_OK, "failed to get redirection capabilities: 0x%08x\n", hr); + todo_wine + ok(redirectionCapabilities==0, "invalid redirection capabilities returned: %d\n", redirectionCapabilities); + + hr = IKnownFolder_SetPath(folder, 0, sWinDir); + todo_wine + ok(hr == E_INVALIDARG, "unexpected value from SetPath: 0x%08x\n", hr); + + hr = IKnownFolder_Release(folder); + ok(hr == S_OK, "failed to release KnownFolder instance: 0x%08x\n", hr); + } + hr = IKnownFolderManager_Release(mgr); ok(hr == S_OK, "failed to release KnownFolderManager instance: 0x%08x\n", hr); } -- 2.11.4.GIT