urlmon: Added MkParseDisplayNameEx tests.

This commit is contained in:
Jacek Caban 2008-01-29 00:19:02 +01:00 committed by Alexandre Julliard
parent 60b0539c87
commit 2c15913180
1 changed files with 52 additions and 0 deletions

View File

@ -258,6 +258,9 @@ static const WCHAR url6[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
static const WCHAR url7[] = {'f','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',
'f','i','l','e','.','t','e','s','t',0};
static const WCHAR url8[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
static const WCHAR url9[] =
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
'/','s','i','t','e','/','a','b','o','u','t',0};
static const WCHAR url4e[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e',
@ -1271,6 +1274,54 @@ static void test_ObtainUserAgentString(void)
HeapFree(GetProcessHeap(), 0, str2);
}
static void test_MkParseDisplayNameEx(void)
{
IMoniker *mon = NULL;
LPWSTR name;
DWORD issys;
ULONG eaten = 0;
IBindCtx *bctx;
HRESULT hres;
static const WCHAR clsid_nameW[] = {'c','l','s','i','d',':',
'2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8',
'-','0','8','0','0','2','B','3','0','3','0','9','D',':',0};
CreateBindCtx(0, &bctx);
hres = MkParseDisplayNameEx(bctx, url9, &eaten, &mon);
ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
ok(eaten == sizeof(url9)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
ok(mon != NULL, "mon == NULL\n");
hres = IMoniker_GetDisplayName(mon, NULL, 0, &name);
ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
ok(!lstrcmpW(name, url9), "wrong display name %s\n", debugstr_w(name));
CoTaskMemFree(name);
hres = IMoniker_IsSystemMoniker(mon, &issys);
ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
ok(issys == MKSYS_URLMONIKER, "issys=%x\n", issys);
IMoniker_Release(mon);
hres = MkParseDisplayNameEx(bctx, clsid_nameW, &eaten, &mon);
ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
ok(eaten == sizeof(clsid_nameW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
ok(mon != NULL, "mon == NULL\n");
hres = IMoniker_IsSystemMoniker(mon, &issys);
ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
ok(issys == MKSYS_CLASSMONIKER, "issys=%x\n", issys);
IMoniker_Release(mon);
hres = MkParseDisplayNameEx(bctx, url8, &eaten, &mon);
ok(FAILED(hres), "MkParseDisplayNameEx succeeded: %08x\n", hres);
IBindCtx_Release(bctx);
}
START_TEST(misc)
{
OleInitialize(NULL);
@ -1290,6 +1341,7 @@ START_TEST(misc)
test_ReleaseBindInfo();
test_UrlMkGetSessionOption();
test_ObtainUserAgentString();
test_MkParseDisplayNameEx();
OleUninitialize();
}