Added Wine ole32 tests.

As of 2004-10-7 we pass all of the tests except the one marked todo
in Wine. It has been disabled.

svn path=/trunk/; revision=11585
This commit is contained in:
Steven Edwards 2004-11-07 22:19:07 +00:00
parent 96c1aa383f
commit 609b0c5307
5 changed files with 345 additions and 0 deletions

View file

@ -0,0 +1,5 @@
*.o
*.a
*.exe
*.map
*.sym

View file

@ -0,0 +1,28 @@
# $Id: Makefile,v 1.1 2004/11/07 22:19:07 sedwards Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
# require os code to explicitly request A/W version of structs/functions
TARGET_CFLAGS += -D_DISABLE_TIDENTS -D__USE_W32API -D_WIN32_IE=0x0600 \
-D_WIN32_WINNT=0x0501 -D__REACTOS__
TARGET_NAME = ole32_test
TARGET_SDKLIBS = oleaut32.a ole32.a ntdll.a
TARGET_OBJECTS = \
testlist.o \
propvariant.o \
storage32.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View file

@ -0,0 +1,211 @@
/*
* PropVariant Tests
*
* Copyright 2004 Robert Shearman
*
* 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 "windows.h"
HRESULT WINAPI PropVariantCopy(PROPVARIANT*,const PROPVARIANT*);
HRESULT WINAPI PropVariantClear(PROPVARIANT*);
#include "wine/test.h"
#ifdef NONAMELESSUNION
# define U(x) (x).u
#else
# define U(x) (x)
#endif
struct valid_mapping
{
BOOL simple;
BOOL with_array;
BOOL with_vector;
BOOL byref;
} valid_types[] =
{
{ TRUE , FALSE, FALSE, FALSE }, /* VT_EMPTY */
{ TRUE , FALSE, FALSE, FALSE }, /* VT_NULL */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_I2 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_I4 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_R4 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_R8 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_CY */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_DATE */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_BSTR */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_DISPATCH */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_ERROR */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_BOOL */
{ FALSE, FALSE, TRUE , FALSE }, /* VT_VARIANT */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_UNKNOWN */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_DECIMAL */
{ FALSE, FALSE, FALSE, FALSE }, /* 15 */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_I1 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_UI1 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_UI2 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_UI4 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_I8 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_UI8 */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_INT */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_UINT */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_VOID */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_HRESULT */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_PTR */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_SAFEARRAY */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_CARRAY */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_USERDEFINED */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_LPSTR */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_LPWSTR */
{ FALSE, FALSE, FALSE, FALSE }, /* 32 */
{ FALSE, FALSE, FALSE, FALSE }, /* 33 */
{ FALSE, FALSE, FALSE, FALSE }, /* 34 */
{ FALSE, FALSE, FALSE, FALSE }, /* 35 */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_RECORD */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_INT_PTR */
{ FALSE, FALSE, FALSE, FALSE }, /* VT_UINT_PTR */
{ FALSE, FALSE, FALSE, FALSE }, /* 39 */
{ FALSE, FALSE, FALSE, FALSE }, /* 40 */
{ FALSE, FALSE, FALSE, FALSE }, /* 41 */
{ FALSE, FALSE, FALSE, FALSE }, /* 42 */
{ FALSE, FALSE, FALSE, FALSE }, /* 43 */
{ FALSE, FALSE, FALSE, FALSE }, /* 44 */
{ FALSE, FALSE, FALSE, FALSE }, /* 45 */
{ FALSE, FALSE, FALSE, FALSE }, /* 46 */
{ FALSE, FALSE, FALSE, FALSE }, /* 47 */
{ FALSE, FALSE, FALSE, FALSE }, /* 48 */
{ FALSE, FALSE, FALSE, FALSE }, /* 49 */
{ FALSE, FALSE, FALSE, FALSE }, /* 50 */
{ FALSE, FALSE, FALSE, FALSE }, /* 51 */
{ FALSE, FALSE, FALSE, FALSE }, /* 52 */
{ FALSE, FALSE, FALSE, FALSE }, /* 53 */
{ FALSE, FALSE, FALSE, FALSE }, /* 54 */
{ FALSE, FALSE, FALSE, FALSE }, /* 55 */
{ FALSE, FALSE, FALSE, FALSE }, /* 56 */
{ FALSE, FALSE, FALSE, FALSE }, /* 57 */
{ FALSE, FALSE, FALSE, FALSE }, /* 58 */
{ FALSE, FALSE, FALSE, FALSE }, /* 59 */
{ FALSE, FALSE, FALSE, FALSE }, /* 60 */
{ FALSE, FALSE, FALSE, FALSE }, /* 61 */
{ FALSE, FALSE, FALSE, FALSE }, /* 62 */
{ FALSE, FALSE, FALSE, FALSE }, /* 63 */
{ TRUE , FALSE, TRUE , FALSE }, /* VT_FILETIME */
{ TRUE , FALSE, FALSE, FALSE }, /* VT_BLOB */
{ TRUE , FALSE, FALSE, FALSE }, /* VT_STREAM */
{ TRUE , FALSE, FALSE, FALSE }, /* VT_STORAGE */
{ TRUE , FALSE, FALSE, FALSE }, /* VT_STREAMED_OBJECT */
{ TRUE , FALSE, FALSE, FALSE }, /* VT_STORED_OBJECT */
{ TRUE , FALSE, FALSE, FALSE }, /* VT_BLOB_OBJECT */
{ TRUE , FALSE, TRUE , FALSE } /* VT_CF */
};
static const char* wine_vtypes[VT_CLSID+1] =
{
"VT_EMPTY","VT_NULL","VT_I2","VT_I4","VT_R4","VT_R8","VT_CY","VT_DATE",
"VT_BSTR","VT_DISPATCH","VT_ERROR","VT_BOOL","VT_VARIANT","VT_UNKNOWN",
"VT_DECIMAL","15","VT_I1","VT_UI1","VT_UI2","VT_UI4","VT_I8","VT_UI8",
"VT_INT","VT_UINT","VT_VOID","VT_HRESULT","VT_PTR","VT_SAFEARRAY",
"VT_CARRAY","VT_USERDEFINED","VT_LPSTR","VT_LPWSTR","32","33","34","35",
"VT_RECORD","VT_INT_PTR","VT_UINT_PTR","39","40","41","42","43","44","45",
"46","47","48","49","50","51","52","53","54","55","56","57","58","59","60",
"61","62","63","VT_FILETIME","VT_BLOB","VT_STREAM","VT_STORAGE",
"VT_STREAMED_OBJECT","VT_STORED_OBJECT","VT_BLOB_OBJECT","VT_CF","VT_CLSID"
};
static void test_validtypes()
{
PROPVARIANT propvar;
HRESULT hr;
unsigned int i;
memset(&propvar, 0, sizeof(propvar));
for (i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++)
{
propvar.vt = i;
hr = PropVariantClear(&propvar);
ok(valid_types[i].simple == !(hr == STG_E_INVALIDPARAMETER),
"PropVariantClear(%s) should have returned 0x%08lx, but returned 0x%08lx\n",
wine_vtypes[i],
valid_types[i].simple ? S_OK : STG_E_INVALIDPARAMETER, hr);
propvar.vt = i | VT_ARRAY;
hr = PropVariantClear(&propvar);
ok(valid_types[i].with_array == !(hr == STG_E_INVALIDPARAMETER),
"PropVariantClear(%s|VT_ARRAY) should have returned 0x%08lx, but returned 0x%08lx\n",
wine_vtypes[i],
valid_types[i].with_array ? S_OK : STG_E_INVALIDPARAMETER, hr);
propvar.vt = i | VT_VECTOR;
hr = PropVariantClear(&propvar);
ok(valid_types[i].with_vector == !(hr == STG_E_INVALIDPARAMETER),
"PropVariantClear(%s|VT_VECTOR) should have returned 0x%08lx, but returned 0x%08lx\n",
wine_vtypes[i],
valid_types[i].with_vector ? S_OK : STG_E_INVALIDPARAMETER, hr);
propvar.vt = i | VT_BYREF;
hr = PropVariantClear(&propvar);
ok(valid_types[i].byref == !(hr == STG_E_INVALIDPARAMETER),
"PropVariantClear(%s|VT_BYREF) should have returned 0x%08lx, but returned 0x%08lx\n",
wine_vtypes[i],
valid_types[i].byref ? S_OK : STG_E_INVALIDPARAMETER, hr);
}
}
static void test_copy()
{
static const char szTestString[] = "Test String";
static const WCHAR wszTestString[] = {'T','e','s','t',' ','S','t','r','i','n','g',0};
PROPVARIANT propvarSrc;
PROPVARIANT propvarDst;
HRESULT hr;
propvarSrc.vt = VT_BSTR;
U(propvarSrc).bstrVal = SysAllocString(wszTestString);
hr = PropVariantCopy(&propvarDst, &propvarSrc);
ok(hr == S_OK, "PropVariantCopy(...VT_BSTR...) failed\n");
ok(!lstrcmpW(U(propvarSrc).bstrVal, U(propvarDst).bstrVal), "BSTR not copied properly\n");
hr = PropVariantClear(&propvarSrc);
ok(hr == S_OK, "PropVariantClear(...VT_BSTR...) failed\n");
hr = PropVariantClear(&propvarDst);
ok(hr == S_OK, "PropVariantClear(...VT_BSTR...) failed\n");
propvarSrc.vt = VT_LPWSTR;
U(propvarSrc).pwszVal = (LPWSTR)wszTestString;
hr = PropVariantCopy(&propvarDst, &propvarSrc);
ok(hr == S_OK, "PropVariantCopy(...VT_LPWSTR...) failed\n");
ok(!lstrcmpW(U(propvarSrc).pwszVal, U(propvarDst).pwszVal), "Wide string not copied properly\n");
hr = PropVariantClear(&propvarDst);
ok(hr == S_OK, "PropVariantClear(...VT_LPWSTR...) failed\n");
memset(&propvarSrc, 0, sizeof(propvarSrc));
propvarSrc.vt = VT_LPSTR;
U(propvarSrc).pszVal = (LPSTR)szTestString;
hr = PropVariantCopy(&propvarDst, &propvarSrc);
ok(hr == S_OK, "PropVariantCopy(...VT_LPSTR...) failed\n");
ok(!strcmp(U(propvarSrc).pszVal, U(propvarDst).pszVal), "String not copied properly\n");
hr = PropVariantClear(&propvarDst);
ok(hr == S_OK, "PropVariantClear(...VT_LPSTR...) failed\n");
memset(&propvarSrc, 0, sizeof(propvarSrc));
}
START_TEST(propvariant)
{
test_validtypes();
test_copy();
}

View file

@ -0,0 +1,74 @@
/*
* 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");
#ifndef __REACTOS__
todo_wine {
ok( stat.grfMode == 0x12, "grf mode is incorrect\n");
}
#endif
ok( !memcmp(&stat.clsid, &test_stg_cls, sizeof test_stg_cls), "CLSID is wrong\n");
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();
}

View file

@ -0,0 +1,27 @@
/* Automatically generated file; DO NOT EDIT!! */
/* stdarg.h is needed for Winelib */
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
extern void func_propvariant(void);
extern void func_storage32(void);
struct test
{
const char *name;
void (*func)(void);
};
static const struct test winetest_testlist[] =
{
{ "propvariant", func_propvariant },
{ "storage32", func_storage32 },
{ 0, 0 }
};
#define WINETEST_WANT_MAIN
#include "wine/test.h"