PATCH: OleFont

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Tested against Primary Word, some Visual Basic program.
Testcase run against native oleaut32.dll.

New file is dlls/oleaut32/tests/olefont.c, attached.

Ciao, Marcus

Changelog:
	OleCreateFontIndirect(NULL,...) uses the OLE StdFont.
	Added testcase for OleCreateFontIndirect(NULL).
	Added VT_NULL -> VT_BOOL variant converter.

Index: dlls/oleaut32/olefont.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/olefont.c,v
retrieving revision 1.21
diff -u -r1.21 olefont.c
--- dlls/oleaut32/olefont.c	23 Jan 2003 01:23:59 -0000	1.21
+++ dlls/oleaut32/olefont.c	23 Jun 2003 22:07:37 -0000
@@ -306,8 +306,22 @@
 
   *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 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);
 
 }
 
Index: dlls/oleaut32/variant.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/variant.c,v
retrieving revision 1.64
diff -u -r1.64 variant.c
--- dlls/oleaut32/variant.c	18 Jun 2003 03:30:40 -0000	1.64
+++ dlls/oleaut32/variant.c	23 Jun 2003 22:07:49 -0000
@@ -1539,6 +1539,7 @@
 	case( VT_BOOL ):
 		switch( vtFrom )
 		{
+		case( VT_NULL ):
 		case( VT_EMPTY ):
 		    	res = S_OK;
 			V_UNION(pd,boolVal) = VARIANT_FALSE;
Index: dlls/oleaut32/tests/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/tests/Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 Makefile.in
--- dlls/oleaut32/tests/Makefile.in	2 Jan 2003 23:13:56 -0000	1.3
+++ dlls/oleaut32/tests/Makefile.in	23 Jun 2003 22:07:49 -0000
@@ -7,6 +7,7 @@
 EXTRALIBS = $(LIBUUID)
 
 CTESTS = \
+	olefont.c \
 	safearray.c \
 	vartest.c
 
/*
 * OLEFONT test program
 *
 * Copyright 2003 Marcus Meissner
 *
 */


#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, &font);
	
	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");

	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");
}

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux