SHELL32: add a test for creating empty shelllink files

Mike McCormack mike at codeweavers.com
Fri Oct 22 03:16:22 CDT 2004


ChangeLog:
* add a test for creating empty shelllink files
-------------- next part --------------
Index: dlls/shell32/tests/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/shell32/tests/Makefile.in,v
retrieving revision 1.5
diff -u -r1.5 Makefile.in
--- dlls/shell32/tests/Makefile.in	21 Oct 2004 19:59:46 -0000	1.5
+++ dlls/shell32/tests/Makefile.in	22 Oct 2004 06:28:57 -0000
@@ -8,6 +8,7 @@
 
 CTESTS = \
 	generated.c \
+	shelllink.c \
 	shellpath.c \
 	shlfileop.c \
 	shlfolder.c \
--- /dev/null	1994-07-18 08:46:18.000000000 +0900
+++ dlls/shell32/tests/shelllink.c	2004-10-22 17:13:06.000000000 +0900
@@ -0,0 +1,79 @@
+/*
+ * Unit tests for shelllinks
+ *
+ * Copyright 2004 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * This is a test program for the SHGet{Special}Folder{Path|Location} functions
+ * of shell32, that get either a filesytem path or a LPITEMIDLIST (shell
+ * namespace) path for a given folder (CSIDL value).
+ *
+ */
+
+#define COBJMACROS
+
+#include <stdarg.h>
+#include <stdio.h>
+#include "windef.h"
+#include "winbase.h"
+#include "shlguid.h"
+#include "shobjidl.h"
+#include "wine/test.h"
+
+static void test_empty_shelllink()
+{
+    HRESULT r;
+    IShellLinkW *sl;
+    WCHAR buffer[0x100];
+    IPersistFile *pf;
+
+    CoInitialize(NULL);
+
+    /* empty shelllink ? */
+    r = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
+                            &IID_IShellLinkW, (LPVOID*)&sl );
+    ok (r == S_OK, "no shelllink\n");
+    if (r == S_OK)
+    {
+        static const WCHAR lnk[]= { 'C',':','\\','t','e','s','t','.','l','n','k',0 };
+
+        buffer[0]='x';
+        buffer[1]=0;
+        r = IShellLinkW_GetPath(sl, buffer, 0x100, NULL, SLGP_RAWPATH );
+        ok (r == S_OK, "GetPath failed\n");
+        ok (buffer[0]==0, "path wrong\n");
+
+        r = IShellLinkW_QueryInterface(sl, &IID_IPersistFile, (LPVOID*) &pf );
+        ok (r == S_OK, "no IPersistFile\n");
+        todo_wine
+        {
+        if (r == S_OK )
+        {
+            r = IPersistFile_Save(pf, lnk, TRUE);
+            ok (r == S_OK, "save failed\n");
+            IPersistFile_Release(pf);
+        }
+
+        IShellLinkW_Release(sl);
+
+        ok (DeleteFileW(lnk), "failed to delete link\n");
+        }
+    }
+}
+
+START_TEST(shelllink)
+{
+    test_empty_shelllink();
+}


More information about the wine-patches mailing list