Jacek Caban : hlink: Added HlinkParseDisplayName tests.

Alexandre Julliard julliard at winehq.org
Mon Feb 4 08:42:51 CST 2008


Module: wine
Branch: master
Commit: 13c4b62a64ccbf9ed45fbc88996aa9021c1521c7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=13c4b62a64ccbf9ed45fbc88996aa9021c1521c7

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Jan 29 00:21:47 2008 +0100

hlink: Added HlinkParseDisplayName tests.

---

 dlls/hlink/tests/hlink.c |   64 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/dlls/hlink/tests/hlink.c b/dlls/hlink/tests/hlink.c
index 271f584..58cd993 100644
--- a/dlls/hlink/tests/hlink.c
+++ b/dlls/hlink/tests/hlink.c
@@ -448,6 +448,69 @@ static void test_HlinkCreateExtensionServices(void)
     IAuthenticate_Release(authenticate);
 }
 
+static void test_HlinkParseDisplayName(void)
+{
+    IMoniker *mon = NULL;
+    LPWSTR name;
+    DWORD issys;
+    ULONG eaten = 0;
+    IBindCtx *bctx;
+    HRESULT hres;
+
+    static const WCHAR winehq_urlW[] =
+            {'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 invalid_urlW[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
+    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 = HlinkParseDisplayName(bctx, winehq_urlW, FALSE, &eaten, &mon);
+    ok(hres == S_OK, "HlinkParseDisplayName failed: %08x\n", hres);
+    ok(eaten == sizeof(winehq_urlW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
+    ok(mon != NULL, "mon == NULL\n");
+
+    hres = IMoniker_GetDisplayName(mon, bctx, 0, &name);
+    ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
+    ok(!lstrcmpW(name, winehq_urlW), "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 = HlinkParseDisplayName(bctx, clsid_nameW, FALSE, &eaten, &mon);
+    ok(hres == S_OK, "HlinkParseDisplayName 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 = HlinkParseDisplayName(bctx, invalid_urlW, FALSE, &eaten, &mon);
+     ok(hres == S_OK, "HlinkParseDisplayName failed: %08x\n", hres);
+    ok(eaten == sizeof(invalid_urlW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
+    ok(mon != NULL, "mon == NULL\n");
+
+    hres = IMoniker_GetDisplayName(mon, bctx, 0, &name);
+    ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
+    ok(!lstrcmpW(name, invalid_urlW), "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_FILEMONIKER, "issys=%x\n", issys);
+
+    IBindCtx_Release(bctx);
+}
+
 START_TEST(hlink)
 {
     CoInitialize(NULL);
@@ -457,6 +520,7 @@ START_TEST(hlink)
     test_persist();
     test_special_reference();
     test_HlinkCreateExtensionServices();
+    test_HlinkParseDisplayName();
 
     CoUninitialize();
 }




More information about the wine-cvs mailing list