Commit 74b17a35 authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

riched20: Handle REO_IOB_SELECTION in IRichEditOle::GetObject().

parent 730b47e5
......@@ -1391,6 +1391,16 @@ IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
else
reobj = cursor.pRun->member.run.reobj;
}
else if (iob == REO_IOB_SELECTION)
{
ME_Cursor *from, *to;
ME_GetSelection(This->editor, &from, &to);
if (!from->pRun->member.run.reobj)
return E_INVALIDARG;
else
reobj = from->pRun->member.run.reobj;
}
else
{
if (iob > IRichEditOle_GetObjectCount(me))
......
......@@ -3328,6 +3328,61 @@ static void test_InsertObject(void)
/* received_reo4 didn't be zeroed in E_INVALIDARG case */
CHECK_REOBJECT_STRUCT(received_reo4, NULL, NULL, reo2.polesite, 2);
SendMessageA(hwnd, EM_SETSEL, 0, 1);
received_reo4.cbStruct = sizeof(received_reo4);
received_reo4.cp = 1;
hr = IRichEditOle_GetObject(reole, REO_IOB_SELECTION, &received_reo4, REO_GETOBJ_ALL_INTERFACES);
ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
CHECK_REOBJECT_STRUCT(received_reo4, NULL, NULL, reo1.polesite, 1);
SendMessageA(hwnd, EM_SETSEL, 1, 2);
received_reo4.cbStruct = sizeof(received_reo4);
received_reo4.cp = 0;
hr = IRichEditOle_GetObject(reole, REO_IOB_SELECTION, &received_reo4, REO_GETOBJ_ALL_INTERFACES);
ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
CHECK_REOBJECT_STRUCT(received_reo4, NULL, NULL, reo3.polesite, 3);
SendMessageA(hwnd, EM_SETSEL, 2, 3);
received_reo4.cbStruct = sizeof(received_reo4);
received_reo4.cp = 0;
hr = IRichEditOle_GetObject(reole, REO_IOB_SELECTION, &received_reo4, REO_GETOBJ_ALL_INTERFACES);
ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
CHECK_REOBJECT_STRUCT(received_reo4, NULL, NULL, reo2.polesite, 2);
SendMessageA(hwnd, EM_SETSEL, 0, 2);
received_reo4.cbStruct = sizeof(received_reo4);
received_reo4.cp = 0;
hr = IRichEditOle_GetObject(reole, REO_IOB_SELECTION, &received_reo4, REO_GETOBJ_ALL_INTERFACES);
ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
CHECK_REOBJECT_STRUCT(received_reo4, NULL, NULL, reo1.polesite, 1);
SendMessageA(hwnd, EM_SETSEL, 1, 3);
received_reo4.cbStruct = sizeof(received_reo4);
received_reo4.cp = 0;
hr = IRichEditOle_GetObject(reole, REO_IOB_SELECTION, &received_reo4, REO_GETOBJ_ALL_INTERFACES);
ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
CHECK_REOBJECT_STRUCT(received_reo4, NULL, NULL, reo3.polesite, 3);
SendMessageA(hwnd, EM_SETSEL, 2, 0);
received_reo4.cbStruct = sizeof(received_reo4);
received_reo4.cp = 0;
hr = IRichEditOle_GetObject(reole, REO_IOB_SELECTION, &received_reo4, REO_GETOBJ_ALL_INTERFACES);
ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
CHECK_REOBJECT_STRUCT(received_reo4, NULL, NULL, reo1.polesite, 1);
SendMessageA(hwnd, EM_SETSEL, 0, 6);
received_reo4.cbStruct = sizeof(received_reo4);
received_reo4.cp = 0;
hr = IRichEditOle_GetObject(reole, REO_IOB_SELECTION, &received_reo4, REO_GETOBJ_ALL_INTERFACES);
ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
CHECK_REOBJECT_STRUCT(received_reo4, NULL, NULL, reo1.polesite, 1);
SendMessageA(hwnd, EM_SETSEL, 4, 5);
received_reo4.cbStruct = sizeof(received_reo4);
received_reo4.cp = 0;
hr = IRichEditOle_GetObject(reole, REO_IOB_SELECTION, &received_reo4, REO_GETOBJ_ALL_INTERFACES);
ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
release_interfaces(&hwnd, &reole, &doc, NULL);
}
......
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