OleCreateFontIndirect(NULL,...) uses the OLE StdFont.

Added testcase for OleCreateFontIndirect(NULL).
Added VT_NULL -> VT_BOOL variant converter.
This commit is contained in:
Marcus Meissner 2003-06-24 19:21:20 +00:00 committed by Alexandre Julliard
parent dc4b0c7655
commit 615615b0c9
5 changed files with 77 additions and 16 deletions

View file

@ -306,8 +306,22 @@ HRESULT WINAPI OleCreateFontIndirect(
*ppvObj = 0;
if (lpFontDesc == 0)
return NO_ERROR; /* MSDN Oct 2001 */
if (!lpFontDesc) {
FONTDESC fd;
WCHAR fname[] = { 'S','y','s','t','e','m',0 };
fd.cbSizeofstruct = sizeof(fd);
fd.lpstrName = fname;
fd.cySize.s.Lo = 80000;
fd.cySize.s.Hi = 0;
fd.sWeight = 0;
fd.sCharset = 0;
fd.fItalic = 0;
fd.fUnderline = 0;
fd.fStrikethrough = 0;
lpFontDesc = &fd;
}
/*
* Try to construct a new instance of the class.
@ -1964,20 +1978,7 @@ static ULONG WINAPI SFCF_Release(LPCLASSFACTORY iface) {
static HRESULT WINAPI SFCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
) {
FONTDESC fd;
WCHAR fname[] = { 'S','y','s','t','e','m',0 };
fd.cbSizeofstruct = sizeof(fd);
fd.lpstrName = fname;
fd.cySize.s.Lo = 80000;
fd.cySize.s.Hi = 0;
fd.sWeight = 0;
fd.sCharset = 0;
fd.fItalic = 0;
fd.fUnderline = 0;
fd.fStrikethrough = 0;
return OleCreateFontIndirect(&fd,riid,ppobj);
return OleCreateFontIndirect(NULL,riid,ppobj);
}

View file

@ -1,5 +1,6 @@
Makefile
oleaut32_test.exe.spec.c
olefont.ok
safearray.ok
testlist.c
vartest.ok

View file

@ -7,6 +7,7 @@ IMPORTS = oleaut32
EXTRALIBS = $(LIBUUID)
CTESTS = \
olefont.c \
safearray.c \
vartest.c

View file

@ -0,0 +1,57 @@
/*
* OLEFONT test program
*
* Copyright 2003 Marcus Meissner
*
*
* 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>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <time.h>
#include <wine/test.h>
#include <winbase.h>
#include <winuser.h>
#include <wingdi.h>
#include <winnls.h>
#include <winerror.h>
#include <winnt.h>
#include <wtypes.h>
#include <olectl.h>
START_TEST(olefont)
{
LPVOID pvObj = NULL;
HRESULT hres;
IFont* font = NULL;
hres = OleCreateFontIndirect(NULL, &IID_IFont, &pvObj);
font = pvObj;
ok(hres == S_OK,"OCFI (NULL,..) does not return 0, but 0x%08lx",hres);
ok(font != NULL,"OCFI (NULL,..) does return NULL, insytead of !NULL");
pvObj = NULL;
hres = IFont_QueryInterface( font, &IID_IFont, &pvObj);
ok(hres == S_OK,"IFont_QI does not return S_OK, but 0x%08lx", hres);
ok(pvObj != NULL,"IFont_QI does return NULL, instead of a ptr");
}

View file

@ -1539,6 +1539,7 @@ static HRESULT Coerce( VARIANTARG* pd, LCID lcid, ULONG dwFlags, VARIANTARG* ps,
case( VT_BOOL ):
switch( vtFrom )
{
case( VT_NULL ):
case( VT_EMPTY ):
res = S_OK;
V_UNION(pd,boolVal) = VARIANT_FALSE;