[APITESTS] Improve and fix tests

This commit is contained in:
Timo Kreuzer 2019-12-09 17:16:02 +01:00
parent cd5cc017cb
commit 465745b683
45 changed files with 832 additions and 566 deletions

View file

@ -11,6 +11,7 @@
#include <debug.h>
#include <stdio.h>
#include <shellutils.h>
#include <versionhelpers.h>
LPITEMIDLIST _CreateDummyPidl()
{
@ -53,12 +54,16 @@ VOID TestUninitialized()
hr = psf->CreateViewObject(NULL, IID_PPV_ARG(IShellView, &psv));
ok(hr == S_OK, "hr = %lx\n", hr);
/* And its display name is ... "C:\Documents and Settings\" */
/* And its display name is ... "C:\Documents and Settings\<username>\Desktop" */
STRRET strretName;
hr = psf->GetDisplayNameOf(NULL,SHGDN_FORPARSING,&strretName);
ok(hr == S_OK, "hr = %lx\n", hr);
ok(strretName.uType == STRRET_WSTR, "strretName.uType == %x\n", strretName.uType);
ok(wcscmp(strretName.pOleStr, L"C:\\Documents and Settings\\") == 0, "wrong name, got: %S\n", strretName.pOleStr);
ok((wcsncmp(strretName.pOleStr, L"C:\\Documents and Settings\\", 26) == 0) ||
(wcsncmp(strretName.pOleStr, L"C:\\Users\\", 9) == 0),
"wrong name, got: %S\n", strretName.pOleStr);
ok(wcscmp(strretName.pOleStr + wcslen(strretName.pOleStr) - 8, L"\\Desktop") == NULL,
"wrong name, got: %S\n", strretName.pOleStr);
hr = psf->GetDisplayNameOf(NULL,SHGDN_FORPARSING|SHGDN_INFOLDER,&strretName);
ok(hr == E_INVALIDARG, "hr = %lx\n", hr);
@ -83,9 +88,9 @@ VOID TestUninitialized()
/* methods that worked before, now fail */
hr = psf->GetDisplayNameOf(NULL,SHGDN_FORPARSING,&strretName);
ok(hr == E_FAIL, "hr = %lx\n", hr);
ok(hr == (IsWindows7OrGreater() ? E_INVALIDARG : E_FAIL), "hr = %lx\n", hr);
hr = psf->EnumObjects(NULL, 0, &penum);
ok(hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "hr = %lx\n", hr);
ok(hr == (IsWindows7OrGreater() ? E_INVALIDARG : HRESULT_FROM_WIN32(ERROR_CANCELLED)), "hr = %lx\n", hr);
/* The following continue to work though */
hr = psf->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget, &pdt));
@ -115,23 +120,23 @@ VOID TestInitialize()
PERSIST_FOLDER_TARGET_INFO pfti = {0};
PERSIST_FOLDER_TARGET_INFO queriedPfti;
hr = ppf3->InitializeEx(NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "hr = %lx\n", hr);
ok(hr == (IsWindows7OrGreater() ? E_INVALIDARG : E_OUTOFMEMORY), "hr = %lx\n", hr);
hr = ppf3->InitializeEx(NULL, NULL, &pfti);
ok(hr == E_INVALIDARG, "hr = %lx\n", hr);
ok(hr == (IsWindows7OrGreater() ? E_INVALIDARG : E_OUTOFMEMORY), "hr = %lx\n", hr);
wcscpy(pfti.szTargetParsingName, L"C:\\");
hr = ppf3->InitializeEx(NULL, NULL, &pfti);
ok(hr == E_INVALIDARG, "hr = %lx\n", hr);
ok(hr == (IsWindows7OrGreater() ? E_INVALIDARG : E_OUTOFMEMORY), "hr = %lx\n", hr);
hr = ppf3->InitializeEx(NULL, testpidl, NULL);
ok(hr == S_OK, "hr = %lx\n", hr);
hr = ppf3->GetFolderTargetInfo(&queriedPfti);
ok(hr == E_FAIL, "hr = %lx\n", hr);
ok(hr == (IsWindows7OrGreater() ? E_FAIL : S_OK), "hr = %lx\n", hr);
hr = psf->GetDisplayNameOf(NULL,SHGDN_FORPARSING,&strretName);
ok(hr == E_FAIL, "hr = %lx\n", hr);
ok(hr == (IsWindows7OrGreater() ? E_INVALIDARG : E_FAIL), "hr = %lx\n", hr);
pfti.szTargetParsingName[0] = 0;
hr = ppf3->InitializeEx(NULL, testpidl, &pfti);
@ -142,7 +147,7 @@ VOID TestInitialize()
ok(wcscmp(queriedPfti.szTargetParsingName, L"") == 0, "wrong name, got: %S\n", queriedPfti.szTargetParsingName);
hr = psf->GetDisplayNameOf(NULL,SHGDN_FORPARSING,&strretName);
ok(hr == E_FAIL, "hr = %lx\n", hr);
ok(hr == (IsWindows7OrGreater() ? E_INVALIDARG : E_FAIL), "hr = %lx\n", hr);
wcscpy(pfti.szTargetParsingName, L"C:\\");
hr = ppf3->InitializeEx(NULL, testpidl, &pfti);