hlink: Add a short test case.

This commit is contained in:
Mike McCormack 2006-08-02 02:19:15 +09:00 committed by Alexandre Julliard
parent af29c05a05
commit a430db9e39
7 changed files with 97 additions and 1 deletions

3
configure vendored

File diff suppressed because one or more lines are too long

View File

@ -1617,6 +1617,7 @@ dlls/glut32/Makefile
dlls/gphoto2.ds/Makefile
dlls/hhctrl.ocx/Makefile
dlls/hlink/Makefile
dlls/hlink/tests/Makefile
dlls/iccvid/Makefile
dlls/icmp/Makefile
dlls/ifsmgr.vxd/Makefile

1
dlls/.gitignore vendored
View File

@ -94,6 +94,7 @@ dsound/libdsound.def
gdi/libgdi32.def
glu32/libglu32.def
glut32/libglut32.def
hlink/libhlink.def
icmp/libicmp.def
imagehlp/libimagehlp.def
imm32/libimm32.def

View File

@ -475,6 +475,7 @@ IMPORT_LIBS = \
gdi/libgdi32.$(IMPLIBEXT) \
glu32/libglu32.$(IMPLIBEXT) \
glut32/libglut32.$(IMPLIBEXT) \
hlink/libhlink.$(IMPLIBEXT) \
icmp/libicmp.$(IMPLIBEXT) \
imagehlp/libimagehlp.$(IMPLIBEXT) \
imm32/libimm32.$(IMPLIBEXT) \
@ -669,6 +670,9 @@ glu32/libglu32.$(IMPLIBEXT): glu32/glu32.spec $(WINEBUILD)
glut32/libglut32.$(IMPLIBEXT): glut32/glut32.spec $(WINEBUILD)
@cd glut32 && $(MAKE) libglut32.$(IMPLIBEXT)
hlink/libhlink.$(IMPLIBEXT): hlink/hlink.spec $(WINEBUILD)
@cd hlink && $(MAKE) libhlink.$(IMPLIBEXT)
icmp/libicmp.$(IMPLIBEXT): icmp/icmp.spec $(WINEBUILD)
@cd icmp && $(MAKE) libicmp.$(IMPLIBEXT)

View File

@ -4,6 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = hlink.dll
IMPORTS = ole32 advapi32 kernel32
IMPORTLIB = libhlink.$(IMPLIBEXT)
DELAYIMPORTS = urlmon
EXTRALIBS = -luuid
@ -12,6 +13,8 @@ C_SRCS = \
hlink_main.c \
link.c
SUBDIRS = tests
@MAKE_DLL_RULES@
### Dependencies:

View File

@ -0,0 +1,14 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = hlink.dll
IMPORTS = hlink ole32 kernel32
EXTRALIBS = -luuid
CTESTS = \
hlink.c
@MAKE_TEST_RULES@
### Dependencies:

72
dlls/hlink/tests/hlink.c Normal file
View File

@ -0,0 +1,72 @@
/*
* Implementation of hyperlinking (hlink.dll)
*
* Copyright 2006 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include <hlink.h>
#include <hlguids.h>
#include "wine/test.h"
START_TEST(hlink)
{
HRESULT r;
IHlink *lnk = NULL;
IMoniker *mk = NULL;
const WCHAR url[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0 };
const WCHAR url2[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',0 };
LPWSTR str = NULL;
CoInitialize(NULL);
r = HlinkCreateFromString(url, NULL, NULL, NULL,
0, NULL, &IID_IHlink, (LPVOID*) &lnk);
ok(r == S_OK, "failed to create link\n");
if (FAILED(r))
return;
r = IHlink_GetMonikerReference(lnk, HLINKGETREF_DEFAULT, NULL, NULL);
ok(r == S_OK, "failed\n");
r = IHlink_GetMonikerReference(lnk, HLINKGETREF_DEFAULT, &mk, &str);
ok(r == S_OK, "failed\n");
ok(mk != NULL, "no moniker\n");
ok(str == NULL, "string should be null\n");
r = IMoniker_Release(mk);
ok( r == 1, "moniker refcount wrong\n");
r = IHlink_GetStringReference(lnk, -1, &str, NULL);
ok(r == S_OK, "failed\n");
r = IHlink_GetStringReference(lnk, HLINKGETREF_DEFAULT, &str, NULL);
ok(r == S_OK, "failed\n");
todo_wine {
ok(!lstrcmpW(str, url2), "url wrong\n");
}
CoTaskMemFree(str);
r = IHlink_GetStringReference(lnk, HLINKGETREF_DEFAULT, NULL, NULL);
ok(r == S_OK, "failed\n");
r = IHlink_GetStringReference(lnk, HLINKGETREF_DEFAULT, NULL, &str);
ok(r == S_OK, "failed\n");
ok(str == NULL, "string should be null\n");
}