Commit be37e951 authored by Benjamin Arai's avatar Benjamin Arai Committed by Alexandre Julliard

oleaut32: Implement function olefont:OLEFontImpl_IsEqual.

parent 41641554
......@@ -1139,8 +1139,37 @@ static HRESULT WINAPI OLEFontImpl_IsEqual(
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;
}
/************************************************************************
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment