Benjamin Arai : oleaut32: Implement function olefont:OLEFontImpl_IsEqual.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 3 15:58:25 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: be37e9510568c5e6afd2ffd7de3a70a42aed5d13
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=be37e9510568c5e6afd2ffd7de3a70a42aed5d13

Author: Benjamin Arai <me at benjaminarai.com>
Date:   Wed Aug  2 16:47:48 2006 -0700

oleaut32: Implement function olefont:OLEFontImpl_IsEqual.

---

 dlls/oleaut32/olefont.c       |   33 +++++++++++++++++++++++++++++++--
 dlls/oleaut32/tests/olefont.c |   20 --------------------
 2 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index bdde164..ee52a05 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -1139,8 +1139,37 @@ static HRESULT WINAPI OLEFontImpl_IsEqua
   IFont* iface,
   IFont* pFontOther)
 {
-  FIXME("(%p, %p), stub!\n",iface,pFontOther);
-  return E_NOTIMPL;
+  OLEFontImpl *left = (OLEFontImpl *)iface;
+  OLEFontImpl *right = (OLEFontImpl *)pFontOther;
+  HRESULT hres;
+  INT left_len,right_len;
+
+  if((iface == NULL) || (pFontOther == NULL))
+    return E_POINTER;
+  else if (left->description.cySize.s.Lo != right->description.cySize.s.Lo)
+    return S_FALSE;
+  else if (left->description.cySize.s.Hi != right->description.cySize.s.Hi)
+    return S_FALSE;
+  else if (left->description.sWeight != right->description.sWeight)
+    return S_FALSE;
+  else if (left->description.sCharset != right->description.sCharset)
+    return S_FALSE;
+  else if (left->description.fItalic != right->description.fItalic)
+    return S_FALSE;
+  else if (left->description.fUnderline != right->description.fUnderline)
+    return S_FALSE;
+  else if (left->description.fStrikethrough != right->description.fStrikethrough)
+    return S_FALSE;
+
+  /* Check from string */
+  left_len = strlenW(left->description.lpstrName);
+  right_len = strlenW(right->description.lpstrName);
+  hres = CompareStringW(0,0,left->description.lpstrName, left_len,
+    right->description.lpstrName, right_len);
+  if (hres != CSTR_EQUAL)
+    return S_FALSE;
+
+  return S_OK;
 }
 
 /************************************************************************
diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c
index bdc7536..bd5fb73 100644
--- a/dlls/oleaut32/tests/olefont.c
+++ b/dlls/oleaut32/tests/olefont.c
@@ -503,27 +503,21 @@ static void test_IsEqual()
     pOleCreateFontIndirect(&fd, &IID_IFont, &pvObj2);
     ifnt2 = pvObj2;
     hres = IFont_IsEqual(ifnt,ifnt2);
-    todo_wine {
     ok(hres == S_OK,
         "IFont_IsEqual: (EQUAL) Expected S_OK but got 0x%08lx\n",hres);
-    }
     IFont_Release(ifnt2);
 
     /* Check for bad pointer */
     hres = IFont_IsEqual(ifnt,NULL);
-    todo_wine {
     ok(hres == E_POINTER,
         "IFont_IsEqual: (NULL) Expected 0x80004003 but got 0x%08lx\n",hres);
-    }
 
     /* Test strName */
     fd.lpstrName = (WCHAR*)arial_font;
     pOleCreateFontIndirect(&fd, &IID_IFont, &pvObj2);
     hres = IFont_IsEqual(ifnt,ifnt2);
-    todo_wine {
     ok(hres == S_FALSE,
         "IFont_IsEqual: (strName) Expected S_FALSE but got 0x%08lx\n",hres);
-    }
     fd.lpstrName = (WCHAR*)system_font;
     IFont_Release(ifnt2);
 
@@ -532,10 +526,8 @@ static void test_IsEqual()
     pOleCreateFontIndirect(&fd, &IID_IFont, &pvObj2);
     ifnt2 = pvObj2;
     hres = IFont_IsEqual(ifnt,ifnt2);
-    todo_wine {
     ok(hres == S_FALSE,
         "IFont_IsEqual: (Lo font size) Expected S_FALSE but got 0x%08lx\n",hres);
-    }
     S(fd.cySize).Lo = 100;
     IFont_Release(ifnt2);
 
@@ -544,10 +536,8 @@ static void test_IsEqual()
     pOleCreateFontIndirect(&fd, &IID_IFont, &pvObj2);
     ifnt2 = pvObj2;
     hres = IFont_IsEqual(ifnt,ifnt2);
-    todo_wine {
     ok(hres == S_FALSE,
         "IFont_IsEqual: (Hi font size) Expected S_FALSE but got 0x%08lx\n",hres);
-    }
     S(fd.cySize).Hi = 100;
     IFont_Release(ifnt2);
 
@@ -556,10 +546,8 @@ static void test_IsEqual()
     pOleCreateFontIndirect(&fd, &IID_IFont, &pvObj2);
     ifnt2 = pvObj2;
     hres = IFont_IsEqual(ifnt,ifnt2);
-    todo_wine {
     ok(hres == S_FALSE,
         "IFont_IsEqual: (Weight) Expected S_FALSE but got 0x%08lx\n",hres);
-    }
     fd.sWeight = 0;
     IFont_Release(ifnt2);
 
@@ -567,10 +555,8 @@ static void test_IsEqual()
     fd.sCharset = 1;
     pOleCreateFontIndirect(&fd, &IID_IFont, &pvObj2);
     hres = IFont_IsEqual(ifnt,ifnt2);
-    todo_wine {
     ok(hres == S_FALSE,
         "IFont_IsEqual: (Charset) Expected S_FALSE but got 0x%08lx\n",hres);
-    }
     fd.sCharset = 0;
     IFont_Release(ifnt2);
 
@@ -578,10 +564,8 @@ static void test_IsEqual()
     fd.fItalic = 1;
     pOleCreateFontIndirect(&fd, &IID_IFont, &pvObj2);
     hres = IFont_IsEqual(ifnt,ifnt2);
-    todo_wine {
     ok(hres == S_FALSE,
         "IFont_IsEqual: (Italic) Expected S_FALSE but got 0x%08lx\n",hres);
-    }
     fd.fItalic = 0;
     IFont_Release(ifnt2);
 
@@ -589,10 +573,8 @@ static void test_IsEqual()
     fd.fUnderline = 1;
     pOleCreateFontIndirect(&fd, &IID_IFont, &pvObj2);
     hres = IFont_IsEqual(ifnt,ifnt2);
-    todo_wine {
     ok(hres == S_FALSE,
         "IFont_IsEqual: (Underline) Expected S_FALSE but got 0x%08lx\n",hres);
-    }
     fd.fUnderline = 0;
     IFont_Release(ifnt2);
 
@@ -600,10 +582,8 @@ static void test_IsEqual()
     fd.fStrikethrough = 1;
     pOleCreateFontIndirect(&fd, &IID_IFont, &pvObj2);
     hres = IFont_IsEqual(ifnt,ifnt2);
-    todo_wine {
     ok(hres == S_FALSE,
         "IFont_IsEqual: (Strikethrough) Expected S_FALSE but got 0x%08lx\n",hres);
-    }
     fd.fStrikethrough = 0;
     IFont_Release(ifnt2);
 




More information about the wine-cvs mailing list