OLE32: add a test for stat'ing a memory based storage file

Mike McCormack mike at codeweavers.com
Tue Aug 10 06:51:13 CDT 2004


After applying this patch, you need to run configure.ac.
This test depends upon the previous patch being applied to succeed.

Mike


ChangeLog:
* add a test for stat'ing a memory based storage file
-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.294
diff -u -r1.294 configure.ac
--- configure.ac	4 Aug 2004 19:10:26 -0000	1.294
+++ configure.ac	10 Aug 2004 10:26:22 -0000
@@ -1604,6 +1605,7 @@
 dlls/ntdll/tests/Makefile
 dlls/odbc32/Makefile
 dlls/ole32/Makefile
+dlls/ole32/tests/Makefile
 dlls/oleacc/Makefile
 dlls/oleaut32/Makefile
 dlls/oleaut32/tests/Makefile
Index: dlls/ole32/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/ole32/Makefile.in,v
retrieving revision 1.34
diff -u -r1.34 Makefile.in
--- dlls/ole32/Makefile.in	27 Jan 2004 00:11:16 -0000	1.34
+++ dlls/ole32/Makefile.in	10 Aug 2004 10:26:38 -0000
@@ -55,6 +55,8 @@
 	drag_move.cur \
 	nodrop.cur 
 
+SUBDIRS = tests
+
 @MAKE_DLL_RULES@
 
 ### Dependencies:
--- /dev/null	1994-07-18 08:46:18.000000000 +0900
+++ dlls/ole32/tests/.cvsignore	2004-08-10 20:18:41.000000000 +0900
@@ -0,0 +1,3 @@
+Makefile
+storage32.ok
+testlist.c
--- /dev/null	1994-07-18 08:46:18.000000000 +0900
+++ dlls/ole32/tests/Makefile.in	2004-08-10 20:24:09.000000000 +0900
@@ -0,0 +1,14 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = ole32.dll
+IMPORTS   = ole32 gdi32 kernel32 ntdll
+EXTRALIBS = -luuid
+
+CTESTS = \
+	storage32.c
+
+ at MAKE_TEST_RULES@
+
+### Dependencies:
--- /dev/null	1994-07-18 08:46:18.000000000 +0900
+++ dlls/ole32/tests/storage32.c	2004-08-10 20:47:46.000000000 +0900
@@ -0,0 +1,72 @@
+/*
+ * Unit tests for OLE storage
+ *
+ * Copyright (c) 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
+ */
+
+#include <stdio.h>
+
+#define COBJMACROS
+
+#include "wine/test.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "ole2.h"
+#include "objidl.h"
+#include "initguid.h"
+
+DEFINE_GUID( test_stg_cls, 0x88888888, 0x0425, 0x0000, 0,0,0,0,0,0,0,0);
+
+void test_hglobal_storage_stat(void)
+{
+    ILockBytes *ilb = NULL;
+    IStorage *stg = NULL;
+    HRESULT r;
+    STATSTG stat;
+    DWORD mode, refcount;
+
+    r = CreateILockBytesOnHGlobal( NULL, TRUE, &ilb );
+    ok( r == S_OK, "CreateILockBytesOnHGlobal failed\n");
+
+    mode = STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE;/*0x1012*/
+    r = StgCreateDocfileOnILockBytes( ilb, mode, 0,  &stg );
+    ok( r == S_OK, "CreateILockBytesOnHGlobal failed\n");
+
+    r = WriteClassStg( stg, &test_stg_cls );
+    ok( r == S_OK, "WriteClassStg failed\n");
+
+    memset( &stat, 0, sizeof stat );
+    r = IStorage_Stat( stg, &stat, 0 );
+
+    ok( stat.pwcsName == NULL, "storage name not null\n");
+    ok( stat.type == 1, "type is wrong\n");
+    todo_wine {
+    ok( stat.grfMode == 0x12, "grf mode is incorrect\n");
+    }
+    ok( !memcmp(&stat.clsid, &test_stg_cls, sizeof test_stg_cls), "CLSID is wrong");
+
+    refcount = IStorage_Release( stg );
+    ok( refcount == 0, "IStorage refcount is wrong\n");
+    refcount = ILockBytes_Release( ilb );
+    ok( refcount == 0, "ILockBytes refcount is wrong\n");
+}
+
+START_TEST(storage32)
+{
+    test_hglobal_storage_stat();
+}


More information about the wine-patches mailing list