Piotr Caban : scrrun/tests: Add IFileSystem3::GetAbsolutePathName tests.
Alexandre Julliard
julliard at winehq.org
Mon Jul 29 14:01:18 CDT 2013
Module: wine
Branch: master
Commit: e7a415b3f81352e53318aee4b6b0cae7a6a5b190
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e7a415b3f81352e53318aee4b6b0cae7a6a5b190
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Jul 25 15:13:26 2013 +0200
scrrun/tests: Add IFileSystem3::GetAbsolutePathName tests.
---
dlls/scrrun/tests/filesystem.c | 71 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c
index 4cd4e2d..801e56f 100644
--- a/dlls/scrrun/tests/filesystem.c
+++ b/dlls/scrrun/tests/filesystem.c
@@ -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);
More information about the wine-cvs
mailing list