riched20/tests: Add some object identity tests.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-03-31 12:23:05 +01:00 committed by Alexandre Julliard
parent 43d377c260
commit f81805507e
2 changed files with 18 additions and 0 deletions

View File

@ -149,6 +149,7 @@ static void test_Interfaces(void)
LRESULT res;
HWND w;
ULONG refcount;
IUnknown *unk, *unk2;
w = new_richedit(NULL);
if (!w) {
@ -180,6 +181,14 @@ static void test_Interfaces(void)
hres = ITextDocument_GetSelection(txtDoc, &txtSel);
ok(hres == S_OK, "got 0x%08x\n", hres);
hres = ITextDocument_QueryInterface(txtDoc, &IID_IUnknown, (void **)&unk);
ok(hres == S_OK, "got 0x%08x\n", hres);
hres = ITextSelection_QueryInterface(txtSel, &IID_IUnknown, (void **)&unk2);
ok(hres == S_OK, "got 0x%08x\n", hres);
ok(unk != unk2, "unknowns are the same\n");
IUnknown_Release(unk2);
IUnknown_Release(unk);
EXPECT_REF(txtDoc, 4);
EXPECT_REF(txtSel, 2);

View File

@ -917,6 +917,7 @@ static void test_QueryInterface(void)
IRichEditOle *reole, *txtsrv_reole;
ITextDocument *txtdoc, *txtsrv_txtdoc;
ITextDocument2Old *txtdoc2old, *txtsrv_txtdoc2old;
IUnknown *unk, *unk2;
ULONG refcount;
if(!init_texthost(&txtserv, &host))
@ -933,6 +934,14 @@ static void test_QueryInterface(void)
refcount = get_refcount((IUnknown *)txtsrv_reole);
ok(refcount == 2, "got wrong ref count: %d\n", refcount);
hres = ITextServices_QueryInterface( txtserv, &IID_IUnknown, (void **)&unk );
ok( hres == S_OK, "got 0x%08x\n", hres );
hres = IRichEditOle_QueryInterface( txtsrv_reole, &IID_IUnknown, (void **)&unk2 );
ok( hres == S_OK, "got 0x%08x\n", hres );
ok( unk == unk2, "unknowns differ\n" );
IUnknown_Release( unk2 );
IUnknown_Release( unk );
hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument, (void **)&txtdoc);
ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
refcount = get_refcount((IUnknown *)txtserv);