scrrun/tests: Add IFileSystem3::GetAbsolutePathName tests.

This commit is contained in:
Piotr Caban 2013-07-25 15:13:26 +02:00 committed by Alexandre Julliard
parent 1027c20cd7
commit e7a415b3f8
1 changed files with 71 additions and 0 deletions

View File

@ -391,6 +391,76 @@ static void test_GetBaseName(void)
}
}
static void test_GetAbsolutePathName(void)
{
static const WCHAR dir1[] = {'t','e','s','t','_','d','i','r','1',0};
static const WCHAR dir2[] = {'t','e','s','t','_','d','i','r','2',0};
static const WCHAR dir_match1[] = {'t','e','s','t','_','d','i','r','*',0};
static const WCHAR dir_match2[] = {'t','e','s','t','_','d','i','*',0};
static const WCHAR cur_dir[] = {'.',0};
WIN32_FIND_DATAW fdata;
HANDLE find;
WCHAR buf[MAX_PATH];
BSTR path, result;
HRESULT hr;
hr = IFileSystem3_GetAbsolutePathName(fs3, NULL, NULL);
ok(hr == E_POINTER, "GetAbsolutePathName returned %x, expected E_POINTER\n", hr);
hr = IFileSystem3_GetAbsolutePathName(fs3, NULL, &result);
ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr);
GetFullPathNameW(cur_dir, MAX_PATH, buf, NULL);
ok(!lstrcmpW(buf, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf));
SysFreeString(result);
find = FindFirstFileW(dir_match2, &fdata);
if(find != INVALID_HANDLE_VALUE) {
skip("GetAbsolutePathName tests\n");
FindClose(find);
return;
}
path = SysAllocString(dir_match1);
hr = IFileSystem3_GetAbsolutePathName(fs3, path, &result);
ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr);
GetFullPathNameW(dir_match1, MAX_PATH, buf, NULL);
ok(!lstrcmpW(buf, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf));
SysFreeString(result);
ok(CreateDirectoryW(dir1, NULL), "CreateDirectory(%s) failed\n", wine_dbgstr_w(dir1));
hr = IFileSystem3_GetAbsolutePathName(fs3, path, &result);
ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr);
GetFullPathNameW(dir1, MAX_PATH, buf, NULL);
ok(!lstrcmpW(buf, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf));
SysFreeString(result);
ok(CreateDirectoryW(dir2, NULL), "CreateDirectory(%s) failed\n", wine_dbgstr_w(dir2));
hr = IFileSystem3_GetAbsolutePathName(fs3, path, &result);
ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr);
if(!lstrcmpW(buf, result)) {
ok(!lstrcmpW(buf, result), "result = %s, expected %s\n",
wine_dbgstr_w(result), wine_dbgstr_w(buf));
}else {
GetFullPathNameW(dir2, MAX_PATH, buf, NULL);
ok(!lstrcmpW(buf, result), "result = %s, expected %s\n",
wine_dbgstr_w(result), wine_dbgstr_w(buf));
}
SysFreeString(result);
SysFreeString(path);
path = SysAllocString(dir_match2);
hr = IFileSystem3_GetAbsolutePathName(fs3, path, &result);
ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr);
GetFullPathNameW(dir_match2, MAX_PATH, buf, NULL);
ok(!lstrcmpW(buf, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf));
SysFreeString(result);
SysFreeString(path);
RemoveDirectoryW(dir1);
RemoveDirectoryW(dir2);
}
START_TEST(filesystem)
{
HRESULT hr;
@ -411,6 +481,7 @@ START_TEST(filesystem)
test_GetParentFolderName();
test_GetFileName();
test_GetBaseName();
test_GetAbsolutePathName();
IFileSystem3_Release(fs3);