Commit 2a2446ab authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

riched20: Return 0x0 size for NULL objects.

parent 25d9fc3e
......@@ -1420,8 +1420,12 @@ static HRESULT WINAPI
IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *reo)
{
IRichEditOleImpl *This = impl_from_IRichEditOle(me);
TRACE("(%p,%p)\n", This, reo);
if (!reo)
return E_INVALIDARG;
if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER;
ME_InsertOLEFromCursor(This->editor, reo, 0);
......@@ -5037,6 +5041,12 @@ void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize)
return;
}
if (!run->ole_obj->poleobj)
{
pSize->cx = pSize->cy = 0;
return;
}
if (IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido) != S_OK)
{
FIXME("Query Interface IID_IDataObject failed!\n");
......
......@@ -3072,6 +3072,42 @@ static void test_SetFont(void)
ITextSelection_Release(selection);
}
static void test_InsertObject(void)
{
IRichEditOle *reole = NULL;
ITextDocument *doc = NULL;
IOleClientSite *clientsite;
REOBJECT reo;
HRESULT hr;
HWND hwnd;
create_interfaces(&hwnd, &reole, &doc, NULL);
hr = IRichEditOle_InsertObject(reole, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = IRichEditOle_GetClientSite(reole, &clientsite);
ok(hr == S_OK, "got 0x%08x\n", hr);
reo.cbStruct = sizeof(reo);
reo.cp = 0;
memset(&reo.clsid, 0, sizeof(reo.clsid));
reo.poleobj = NULL;
reo.pstg = NULL;
reo.polesite = clientsite;
reo.sizel.cx = 10;
reo.sizel.cy = 10;
reo.dvaspect = DVASPECT_CONTENT;
reo.dwFlags = 0;
reo.dwUser = 0;
hr = IRichEditOle_InsertObject(reole, &reo);
ok(hr == S_OK, "got 0x%08x\n", hr);
IOleClientSite_Release(clientsite);
release_interfaces(&hwnd, &reole, &doc, NULL);
}
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
......@@ -3104,4 +3140,5 @@ START_TEST(richole)
test_Select();
test_GetStoryType();
test_SetFont();
test_InsertObject();
}
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