hlink/tests: Repair test to work as intended.

This commit is contained in:
Andrew Eikum 2009-12-28 17:40:52 -06:00 committed by Alexandre Julliard
parent 906c963947
commit ff13146e92
1 changed files with 11 additions and 8 deletions

View File

@ -41,17 +41,23 @@ static void test_SetInitialHlink(void)
IMoniker *dummy, *found_moniker; IMoniker *dummy, *found_moniker;
IBindCtx *bindctx; IBindCtx *bindctx;
WCHAR one[] = {'1',0}; WCHAR one[] = {'1',0};
WCHAR friend[] = {'f','r','i','e','n','d',0}; WCHAR five[] = {'5',0};
WCHAR *found_name; WCHAR *found_name, *exp_name;
HRESULT hres; HRESULT hres;
hres = CreateItemMoniker(one, one, &dummy); hres = CreateBindCtx(0, &bindctx);
ok(hres == S_OK, "CreateBindCtx failed: 0x%08x\n", hres);
hres = CreateItemMoniker(one, five, &dummy);
ok(hres == S_OK, "CreateItemMoniker failed: 0x%08x\n", hres); ok(hres == S_OK, "CreateItemMoniker failed: 0x%08x\n", hres);
hres = IMoniker_GetDisplayName(dummy, bindctx, NULL, &exp_name);
ok(hres == S_OK, "GetDisplayName failed: 0x%08x\n", hres);
hres = HlinkCreateBrowseContext(NULL, &IID_IHlinkBrowseContext, (void**)&bc); hres = HlinkCreateBrowseContext(NULL, &IID_IHlinkBrowseContext, (void**)&bc);
ok(hres == S_OK, "HlinkCreateBrowseContext failed: 0x%08x\n", hres); ok(hres == S_OK, "HlinkCreateBrowseContext failed: 0x%08x\n", hres);
hres = IHlinkBrowseContext_SetInitialHlink(bc, dummy, one, friend); hres = IHlinkBrowseContext_SetInitialHlink(bc, dummy, one, NULL);
ok(hres == S_OK, "SetInitialHlink failed: 0x%08x\n", hres); ok(hres == S_OK, "SetInitialHlink failed: 0x%08x\n", hres);
hres = IHlinkBrowseContext_GetHlink(bc, HLID_CURRENT, &found_hlink); hres = IHlinkBrowseContext_GetHlink(bc, HLID_CURRENT, &found_hlink);
@ -60,12 +66,9 @@ static void test_SetInitialHlink(void)
hres = IHlink_GetMonikerReference(found_hlink, HLINKGETREF_DEFAULT, &found_moniker, NULL); hres = IHlink_GetMonikerReference(found_hlink, HLINKGETREF_DEFAULT, &found_moniker, NULL);
ok(hres == S_OK, "GetMonikerReference failed: 0x%08x\n", hres); ok(hres == S_OK, "GetMonikerReference failed: 0x%08x\n", hres);
hres = CreateBindCtx(0, &bindctx);
ok(hres == S_OK, "CreateBindCtx failed: 0x%08x\n", hres);
hres = IMoniker_GetDisplayName(found_moniker, bindctx, NULL, &found_name); hres = IMoniker_GetDisplayName(found_moniker, bindctx, NULL, &found_name);
ok(hres == S_OK, "GetDisplayName failed: 0x%08x\n", hres); ok(hres == S_OK, "GetDisplayName failed: 0x%08x\n", hres);
ok(strcmp_ww(found_name, friend), "Found display name should not have been %s\n", wine_dbgstr_w(friend)); ok(!strcmp_ww(found_name, exp_name), "Found display name should have been %s, was: %s\n", wine_dbgstr_w(exp_name), wine_dbgstr_w(found_name));
IBindCtx_Release(bindctx); IBindCtx_Release(bindctx);
IMoniker_Release(found_moniker); IMoniker_Release(found_moniker);