taskschd/tests: Add more task folder tests.

This commit is contained in:
Dmitry Timoshkov 2014-01-16 18:02:25 +09:00 committed by Alexandre Julliard
parent 006aadd3d2
commit 7341996f5d
1 changed files with 81 additions and 2 deletions

View File

@ -118,19 +118,21 @@ todo_wine
static void test_GetFolder(void)
{
static WCHAR dot[] = { '.',0 };
static WCHAR empty[] = { 0 };
static WCHAR slash[] = { '/',0 };
static WCHAR bslash[] = { '\\',0 };
static WCHAR Wine[] = { '\\','W','i','n','e',0 };
static WCHAR Wine_Folder1[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','1',0 };
static WCHAR Wine_Folder1_[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','1','\\',0 };
static WCHAR Wine_Folder1_Folder2[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','1','\\','F','o','l','d','e','r','2',0 };
static WCHAR Folder1_Folder2[] = { '\\','F','o','l','d','e','r','1','\\','F','o','l','d','e','r','2',0 };
static const WCHAR Folder1[] = { 'F','o','l','d','e','r','1',0 };
static const WCHAR Folder2[] = { 'F','o','l','d','e','r','2',0 };
HRESULT hr;
BSTR bstr;
VARIANT v_null;
ITaskService *service;
ITaskFolder *folder, *subfolder;
ITaskFolder *folder, *subfolder, *subfolder2;
hr = CoCreateInstance(&CLSID_TaskScheduler, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskService, (void **)&service);
if (hr != S_OK)
@ -162,6 +164,12 @@ todo_wine
todo_wine
ok(hr == E_POINTER, "expected E_POINTER, got %#x\n", hr);
hr = ITaskService_GetFolder(service, empty, &folder);
todo_wine
ok(hr == S_OK, "GetFolder error %#x\n", hr);
if (hr == S_OK)
ITaskFolder_Release(folder);
hr = ITaskService_GetFolder(service, NULL, &folder);
todo_wine
ok(hr == S_OK, "GetFolder error %#x\n", hr);
@ -198,6 +206,9 @@ todo_wine
hr = ITaskFolder_CreateFolder(folder, slash, v_null, &subfolder);
ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME), "expected ERROR_INVALID_NAME, got %#x\n", hr);
hr = ITaskService_GetFolder(service, Wine_Folder1_Folder2, &subfolder);
ok(hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "expected ERROR_PATH_NOT_FOUND, got %#x\n", hr);
hr = ITaskFolder_CreateFolder(folder, bslash, v_null, &subfolder);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
@ -266,10 +277,78 @@ todo_wine
SysFreeString(bstr);
hr = ITaskFolder_get_Path(subfolder, &bstr);
ok(hr == S_OK, "get_Path error %#x\n", hr);
ok(!lstrcmpW(bstr, Wine_Folder1), "expected Wine\\Folder1, got %s\n", wine_dbgstr_w(bstr));
ok(!lstrcmpW(bstr, Wine_Folder1), "expected \\Wine\\Folder1, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
ITaskFolder_Release(subfolder);
hr = ITaskService_GetFolder(service, Wine, &subfolder);
ok(hr == S_OK, "GetFolder error %#x\n", hr);
hr = ITaskFolder_get_Name(subfolder, &bstr);
ok (hr == S_OK, "get_Name error %#x\n", hr);
ok(!lstrcmpW(bstr, Wine+1), "expected Wine, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
hr = ITaskFolder_get_Path(subfolder, &bstr);
ok(hr == S_OK, "get_Path error %#x\n", hr);
ok(!lstrcmpW(bstr, Wine), "expected \\Wine, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
ITaskFolder_Release(subfolder);
hr = ITaskService_GetFolder(service, Wine+1, &subfolder);
ok(hr == S_OK, "GetFolder error %#x\n", hr);
hr = ITaskFolder_get_Name(subfolder, &bstr);
ok (hr == S_OK, "get_Name error %#x\n", hr);
ok(!lstrcmpW(bstr, Wine+1), "expected Wine, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
hr = ITaskFolder_get_Path(subfolder, &bstr);
ok(hr == S_OK, "get_Path error %#x\n", hr);
ok(!lstrcmpW(bstr, Wine+1), "expected Wine, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
hr = ITaskFolder_GetFolder(subfolder, bslash, &subfolder2);
ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME), "expected ERROR_INVALID_NAME, got %#x\n", hr);
hr = ITaskFolder_GetFolder(subfolder, NULL, &subfolder2);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
hr = ITaskFolder_GetFolder(subfolder, empty, &subfolder2);
ok(hr == S_OK, "GetFolder error %#x\n", hr);
hr = ITaskFolder_get_Name(subfolder2, &bstr);
ok (hr == S_OK, "get_Name error %#x\n", hr);
ok(!lstrcmpW(bstr, Wine+1), "expected Wine, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
hr = ITaskFolder_get_Path(subfolder2, &bstr);
ok(hr == S_OK, "get_Path error %#x\n", hr);
ok(!lstrcmpW(bstr, Wine+1), "expected Wine, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
ITaskFolder_Release(subfolder2);
hr = ITaskFolder_GetFolder(subfolder, Folder1_Folder2, &subfolder2);
ok(hr == S_OK, "GetFolder error %#x\n", hr);
hr = ITaskFolder_get_Name(subfolder2, &bstr);
ok (hr == S_OK, "get_Name error %#x\n", hr);
ok(!lstrcmpW(bstr, Folder2), "expected Folder2, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
hr = ITaskFolder_get_Path(subfolder2, &bstr);
ok(hr == S_OK, "get_Path error %#x\n", hr);
ok(!lstrcmpW(bstr, Wine_Folder1_Folder2+1), "expected Wine\\Folder1\\Folder2, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
ITaskFolder_Release(subfolder2);
hr = ITaskFolder_GetFolder(subfolder, Folder1_Folder2+1, &subfolder2);
ok(hr == S_OK, "GetFolder error %#x\n", hr);
hr = ITaskFolder_get_Name(subfolder2, &bstr);
ok (hr == S_OK, "get_Name error %#x\n", hr);
ok(!lstrcmpW(bstr, Folder2), "expected Folder2, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
hr = ITaskFolder_get_Path(subfolder2, &bstr);
ok(hr == S_OK, "get_Path error %#x\n", hr);
ok(!lstrcmpW(bstr, Wine_Folder1_Folder2+1), "expected Wine\\Folder1\\Folder2, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
ITaskFolder_Release(subfolder2);
ITaskFolder_Release(subfolder);
hr = ITaskFolder_DeleteFolder(folder, Wine_Folder1_Folder2, 0);
ok(hr == S_OK, "DeleteFolder error %#x\n", hr);
ITaskFolder_DeleteFolder(folder, Wine_Folder1+1, 0);