Commit 3e08cebe authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

riched20/tests: Test ITextServices_TxGetText() with OLE obejct.

parent db7964bb
......@@ -650,9 +650,30 @@ static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
return TRUE;
}
static void fill_reobject_struct(REOBJECT *reobj, LONG cp, LPOLEOBJECT poleobj,
LPSTORAGE pstg, LPOLECLIENTSITE polesite, LONG sizel_cx,
LONG sizel_cy, DWORD aspect, DWORD flags, DWORD user)
{
reobj->cbStruct = sizeof(*reobj);
reobj->clsid = CLSID_NULL;
reobj->cp = cp;
reobj->poleobj = poleobj;
reobj->pstg = pstg;
reobj->polesite = polesite;
reobj->sizel.cx = sizel_cx;
reobj->sizel.cy = sizel_cy;
reobj->dvaspect = aspect;
reobj->dwFlags = flags;
reobj->dwUser = user;
}
static void test_TxGetText(void)
{
const WCHAR *expected_string;
IOleClientSite *clientsite;
ITextServices *txtserv;
IRichEditOle *reole;
REOBJECT reobject;
ITextHost *host;
HRESULT hres;
BSTR rettext;
......@@ -664,6 +685,24 @@ static void test_TxGetText(void)
ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
SysFreeString(rettext);
hres = ITextServices_TxSetText(txtserv, L"abcdefg");
ok(hres == S_OK, "Got hres: %#x.\n", hres);
hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&reole);
ok(hres == S_OK, "Got hres: %#x.\n", hres);
hres = IRichEditOle_GetClientSite(reole, &clientsite);
ok(hres == S_OK, "Got hres: %#x.\n", hres);
expected_string = L"abc\xfffc""defg";
fill_reobject_struct(&reobject, 3, NULL, NULL, clientsite, 10, 10, DVASPECT_CONTENT, 0, 1);
hres = IRichEditOle_InsertObject(reole, &reobject);
ok(hres == S_OK, "Got hres: %#x.\n", hres);
hres = ITextServices_TxGetText(txtserv, &rettext);
ok(hres == S_OK, "Got hres: %#x.\n", hres);
ok(lstrlenW(rettext) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(rettext));
todo_wine ok(!lstrcmpW(rettext, expected_string), "Got wrong content: %s.\n", debugstr_w(rettext));
SysFreeString(rettext);
IOleClientSite_Release(clientsite);
IRichEditOle_Release(reole);
ITextServices_Release(txtserv);
ITextHost_Release(host);
}
......
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