riched20: Implement ITextDocument_fnGetSelection.

This commit is contained in:
Dan Hipschman 2008-06-25 16:31:39 -07:00 committed by Alexandre Julliard
parent 74b78100f3
commit 36aa6c4c44
3 changed files with 1033 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
TESTDLL = riched20.dll TESTDLL = riched20.dll
IMPORTS = ole32 user32 gdi32 kernel32 IMPORTS = uuid ole32 user32 gdi32 kernel32
CTESTS = \ CTESTS = \
editor.c \ editor.c \

View File

@ -34,6 +34,8 @@
#include <initguid.h> #include <initguid.h>
DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d); DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
DEFINE_GUID(IID_ITextRange, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
static HMODULE hmoduleRichEdit; static HMODULE hmoduleRichEdit;
@ -57,6 +59,8 @@ START_TEST(richole)
{ {
IRichEditOle *reOle = NULL; IRichEditOle *reOle = NULL;
ITextDocument *txtDoc = NULL; ITextDocument *txtDoc = NULL;
ITextSelection *txtSel = NULL;
IUnknown *punk;
HRESULT hres; HRESULT hres;
LRESULT res; LRESULT res;
HWND w; HWND w;
@ -81,7 +85,36 @@ START_TEST(richole)
ok(hres == S_OK, "IRichEditOle_QueryInterface\n"); ok(hres == S_OK, "IRichEditOle_QueryInterface\n");
ok(txtDoc != NULL, "IRichEditOle_QueryInterface\n"); ok(txtDoc != NULL, "IRichEditOle_QueryInterface\n");
hres = ITextDocument_GetSelection(txtDoc, &txtSel);
ok(hres == S_OK, "ITextDocument_GetSelection\n");
ok(txtSel != NULL, "ITextDocument_GetSelection\n");
punk = NULL;
hres = ITextSelection_QueryInterface(txtSel, &IID_ITextSelection, (void **) &punk);
ok(hres == S_OK, "ITextSelection_QueryInterface\n");
ok(punk != NULL, "ITextSelection_QueryInterface\n");
IUnknown_Release(punk);
punk = NULL;
hres = ITextSelection_QueryInterface(txtSel, &IID_ITextRange, (void **) &punk);
ok(hres == S_OK, "ITextSelection_QueryInterface\n");
ok(punk != NULL, "ITextSelection_QueryInterface\n");
IUnknown_Release(punk);
punk = NULL;
hres = ITextSelection_QueryInterface(txtSel, &IID_IDispatch, (void **) &punk);
ok(hres == S_OK, "ITextSelection_QueryInterface\n");
ok(punk != NULL, "ITextSelection_QueryInterface\n");
IUnknown_Release(punk);
ITextDocument_Release(txtDoc); ITextDocument_Release(txtDoc);
IUnknown_Release(reOle); IUnknown_Release(reOle);
DestroyWindow(w); DestroyWindow(w);
/* Methods should return CO_E_RELEASED if the backing document has
been released. One test should suffice. */
hres = ITextSelection_CanEdit(txtSel, NULL);
ok(hres == CO_E_RELEASED, "ITextSelection after ITextDocument destroyed\n");
ITextSelection_Release(txtSel);
} }