ReactOS 0.4.16-dev-1481-ga753f34
txtsrv.c
Go to the documentation of this file.
1/*
2 * Unit test suite for windowless rich edit controls
3 *
4 * Copyright 2008 Maarten Lankhorst
5 * Copyright 2008 Austin Lund
6 * Copyright 2008 Dylan Smith
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#define COBJMACROS
24#define CONST_VTABLE
25
26#include <stdio.h>
27#include <stdarg.h>
28#include <windef.h>
29#include <winbase.h>
30#include <objbase.h>
31#include <richedit.h>
32#include <tom.h>
33#include <richole.h>
34#include <initguid.h>
35#include <imm.h>
36#include <textserv.h>
37#include <wine/test.h>
38#include <oleauto.h>
39#include <limits.h>
40
41#define DEFINE_EXPECT(func) \
42 static UINT called_count_ ## func = 0
43
44#define INCREASE_CALL_COUNTER(func) \
45 do { \
46 called_count_ ## func++; \
47 }while(0)
48
49#define CHECK_CALLED(func) \
50 do { \
51 ok(called_count_ ## func, "expected " #func "\n"); \
52 }while(0)
53
54#define CHECK_NOT_CALLED(func) \
55 do { \
56 ok(!called_count_ ## func, "unexpected " #func "\n"); \
57 }while(0)
58
59#define CLEAR_COUNTER(func) \
60 called_count_ ## func = 0
61
67
68/* Define C Macros for ITextServices calls. */
69
70/* Use a special table for x86 machines to convert the thiscall
71 * calling convention. This isn't needed on other platforms. */
72#if defined(__i386__) && !defined(__MINGW32__) && (!defined(_MSC_VER) || !defined(__clang__))
73static ITextServicesVtbl itextServicesStdcallVtbl;
74#define TXTSERV_VTABLE(This) (&itextServicesStdcallVtbl)
75#else /* __i386__ */
76#define TXTSERV_VTABLE(This) (This)->lpVtbl
77#endif /* __i386__ */
78
79#define ITextServices_TxSendMessage(This,a,b,c,d) TXTSERV_VTABLE(This)->TxSendMessage(This,a,b,c,d)
80#define ITextServices_TxDraw(This,a,b,c,d,e,f,g,h,i,j,k,l) TXTSERV_VTABLE(This)->TxDraw(This,a,b,c,d,e,f,g,h,i,j,k,l)
81#define ITextServices_TxGetHScroll(This,a,b,c,d,e) TXTSERV_VTABLE(This)->TxGetHScroll(This,a,b,c,d,e)
82#define ITextServices_TxGetVScroll(This,a,b,c,d,e) TXTSERV_VTABLE(This)->TxGetVScroll(This,a,b,c,d,e)
83#define ITextServices_OnTxSetCursor(This,a,b,c,d,e,f,g,h,i) TXTSERV_VTABLE(This)->OnTxSetCursor(This,a,b,c,d,e,f,g,h,i)
84#define ITextServices_TxQueryHitPoint(This,a,b,c,d,e,f,g,h,i,j) TXTSERV_VTABLE(This)->TxQueryHitPoint(This,a,b,c,d,e,f,g,h,i,j)
85#define ITextServices_OnTxInPlaceActivate(This,a) TXTSERV_VTABLE(This)->OnTxInPlaceActivate(This,a)
86#define ITextServices_OnTxInPlaceDeactivate(This) TXTSERV_VTABLE(This)->OnTxInPlaceDeactivate(This)
87#define ITextServices_OnTxUIActivate(This) TXTSERV_VTABLE(This)->OnTxUIActivate(This)
88#define ITextServices_OnTxUIDeactivate(This) TXTSERV_VTABLE(This)->OnTxUIDeactivate(This)
89#define ITextServices_TxGetText(This,a) TXTSERV_VTABLE(This)->TxGetText(This,a)
90#define ITextServices_TxSetText(This,a) TXTSERV_VTABLE(This)->TxSetText(This,a)
91#define ITextServices_TxGetCurTargetX(This,a) TXTSERV_VTABLE(This)->TxGetCurTargetX(This,a)
92#define ITextServices_TxGetBaseLinePos(This,a) TXTSERV_VTABLE(This)->TxGetBaseLinePos(This,a)
93#define ITextServices_TxGetNaturalSize(This,a,b,c,d,e,f,g,h) TXTSERV_VTABLE(This)->TxGetNaturalSize(This,a,b,c,d,e,f,g,h)
94#define ITextServices_TxGetDropTarget(This,a) TXTSERV_VTABLE(This)->TxGetDropTarget(This,a)
95#define ITextServices_OnTxPropertyBitsChange(This,a,b) TXTSERV_VTABLE(This)->OnTxPropertyBitsChange(This,a,b)
96#define ITextServices_TxGetCachedSize(This,a,b) TXTSERV_VTABLE(This)->TxGetCachedSize(This,a,b)
97
98/* Set the WINETEST_DEBUG environment variable to be greater than 1 for verbose
99 * function call traces of ITextHost. */
100#define TRACECALL if(winetest_debug > 1) trace
101
102/************************************************************************/
103/* ITextHost implementation for conformance testing. */
104
108
109typedef struct ITextHostTestImpl
110{
118
119static inline ITextHostTestImpl *impl_from_ITextHost(ITextHost *iface)
120{
121 return CONTAINING_RECORD(iface, ITextHostTestImpl, ITextHost_iface);
122}
123
124static const WCHAR lorem[] = L"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
125 "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "
126 "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. "
127 "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
128
130 REFIID riid,
131 LPVOID *ppvObject)
132{
134
136 *ppvObject = &This->ITextHost_iface;
137 ITextHost_AddRef((ITextHost *)*ppvObject);
138 return S_OK;
139 }
140
141 return E_NOINTERFACE;
142}
143
144static ULONG WINAPI ITextHostImpl_AddRef(ITextHost *iface)
145{
147 ULONG refCount = InterlockedIncrement(&This->refCount);
148 return refCount;
149}
150
151static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface)
152{
154 ULONG refCount = InterlockedDecrement(&This->refCount);
155
156 if (!refCount)
157 {
159 return 0;
160 } else {
161 return refCount;
162 }
163}
164
165static HDC __thiscall ITextHostImpl_TxGetDC(ITextHost *iface)
166{
168 TRACECALL("Call to TxGetDC(%p)\n", This);
169 if (This->window) return GetDC( This->window );
170 return NULL;
171}
172
174{
176 TRACECALL("Call to TxReleaseDC(%p)\n", This);
177 if (This->window) return ReleaseDC( This->window, hdc );
178 return 0;
179}
180
181static BOOL __thiscall ITextHostImpl_TxShowScrollBar(ITextHost *iface, INT fnBar, BOOL fShow)
182{
184 TRACECALL("Call to TxShowScrollBar(%p, fnBar=%d, fShow=%d)\n",
185 This, fnBar, fShow);
186 return FALSE;
187}
188
189static BOOL __thiscall ITextHostImpl_TxEnableScrollBar(ITextHost *iface, INT fuSBFlags, INT fuArrowflags)
190{
192 TRACECALL("Call to TxEnableScrollBar(%p, fuSBFlags=%d, fuArrowflags=%d)\n",
193 This, fuSBFlags, fuArrowflags);
194 return FALSE;
195}
196
197static BOOL __thiscall ITextHostImpl_TxSetScrollRange(ITextHost *iface, INT fnBar, LONG nMinPos,
198 INT nMaxPos, BOOL fRedraw)
199{
201 TRACECALL("Call to TxSetScrollRange(%p, fnBar=%d, nMinPos=%ld, nMaxPos=%d, fRedraw=%d)\n",
202 This, fnBar, nMinPos, nMaxPos, fRedraw);
203 return FALSE;
204}
205
206static BOOL __thiscall ITextHostImpl_TxSetScrollPos(ITextHost *iface, INT fnBar, INT nPos, BOOL fRedraw)
207{
209 TRACECALL("Call to TxSetScrollPos(%p, fnBar=%d, nPos=%d, fRedraw=%d)\n",
210 This, fnBar, nPos, fRedraw);
211 return FALSE;
212}
213
214static void __thiscall ITextHostImpl_TxInvalidateRect(ITextHost *iface, LPCRECT prc, BOOL fMode)
215{
217 TRACECALL("Call to TxInvalidateRect(%p, prc=%p, fMode=%d)\n",
218 This, prc, fMode);
219}
220
221static void __thiscall ITextHostImpl_TxViewChange(ITextHost *iface, BOOL fUpdate)
222{
224 TRACECALL("Call to TxViewChange(%p, fUpdate=%d)\n",
225 This, fUpdate);
227}
228
229static BOOL __thiscall ITextHostImpl_TxCreateCaret(ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight)
230{
232 TRACECALL("Call to TxCreateCaret(%p, nbmp=%p, xWidth=%d, yHeight=%d)\n",
233 This, hbmp, xWidth, yHeight);
234 return FALSE;
235}
236
237static BOOL __thiscall ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow)
238{
240 TRACECALL("Call to TxShowCaret(%p, fShow=%d)\n",
241 This, fShow);
242 return FALSE;
243}
244
246{
248 TRACECALL("Call to TxSetCaretPos(%p, x=%d, y=%d)\n", This, x, y);
249 return FALSE;
250}
251
252static BOOL __thiscall ITextHostImpl_TxSetTimer(ITextHost *iface, UINT idTimer, UINT uTimeout)
253{
255 TRACECALL("Call to TxSetTimer(%p, idTimer=%u, uTimeout=%u)\n",
256 This, idTimer, uTimeout);
257 return FALSE;
258}
259
260static void __thiscall ITextHostImpl_TxKillTimer(ITextHost *iface, UINT idTimer)
261{
263 TRACECALL("Call to TxKillTimer(%p, idTimer=%u)\n", This, idTimer);
264}
265
266static void __thiscall ITextHostImpl_TxScrollWindowEx(ITextHost *iface, INT dx, INT dy, LPCRECT lprcScroll,
267 LPCRECT lprcClip, HRGN hRgnUpdate, LPRECT lprcUpdate,
268 UINT fuScroll)
269{
271 TRACECALL("Call to TxScrollWindowEx(%p, %d, %d, %p, %p, %p, %p, %d)\n",
272 This, dx, dy, lprcScroll, lprcClip, hRgnUpdate, lprcUpdate, fuScroll);
274}
275
276static void __thiscall ITextHostImpl_TxSetCapture(ITextHost *iface, BOOL fCapture)
277{
279 TRACECALL("Call to TxSetCapture(%p, fCapture=%d)\n", This, fCapture);
280}
281
282static void __thiscall ITextHostImpl_TxSetFocus(ITextHost *iface)
283{
285 TRACECALL("Call to TxSetFocus(%p)\n", This);
286}
287
288static void __thiscall ITextHostImpl_TxSetCursor(ITextHost *iface, HCURSOR hcur, BOOL fText)
289{
291 TRACECALL("Call to TxSetCursor(%p, hcur=%p, fText=%d)\n",
292 This, hcur, fText);
293}
294
296{
298 TRACECALL("Call to TxScreenToClient(%p, lppt=%p)\n", This, lppt);
299 return FALSE;
300}
301
303{
305 TRACECALL("Call to TxClientToScreen(%p, lppt=%p)\n", This, lppt);
306 return FALSE;
307}
308
309static HRESULT __thiscall ITextHostImpl_TxActivate(ITextHost *iface, LONG *plOldState)
310{
312 TRACECALL("Call to TxActivate(%p, plOldState=%p)\n", This, plOldState);
313 return E_NOTIMPL;
314}
315
316static HRESULT __thiscall ITextHostImpl_TxDeactivate(ITextHost *iface, LONG lNewState)
317{
319 TRACECALL("Call to TxDeactivate(%p, lNewState=%ld)\n", This, lNewState);
320 return E_NOTIMPL;
321}
322
324{
326 TRACECALL("Call to TxGetClientRect(%p, prc=%p)\n", This, prc);
328 *prc = This->client_rect;
329 return S_OK;
330}
331
333{
335 TRACECALL("Call to TxGetViewInset(%p, prc=%p)\n", This, prc);
336 return E_NOTIMPL;
337}
338
339static HRESULT __thiscall ITextHostImpl_TxGetCharFormat(ITextHost *iface, const CHARFORMATW **ppCF)
340{
342 TRACECALL("Call to TxGetCharFormat(%p, ppCF=%p)\n", This, ppCF);
343 *ppCF = (CHARFORMATW *)&This->char_format;
344 return S_OK;
345}
346
347static HRESULT __thiscall ITextHostImpl_TxGetParaFormat(ITextHost *iface, const PARAFORMAT **ppPF)
348{
350 TRACECALL("Call to TxGetParaFormat(%p, ppPF=%p)\n", This, ppPF);
351 return E_NOTIMPL;
352}
353
354static COLORREF __thiscall ITextHostImpl_TxGetSysColor(ITextHost *iface, int nIndex)
355{
357 TRACECALL("Call to TxGetSysColor(%p, nIndex=%d)\n", This, nIndex);
358 return E_NOTIMPL;
359}
360
362{
364 TRACECALL("Call to TxGetBackStyle(%p, pStyle=%p)\n", This, pStyle);
365 return E_NOTIMPL;
366}
367
368static HRESULT __thiscall ITextHostImpl_TxGetMaxLength(ITextHost *iface, DWORD *pLength)
369{
371 TRACECALL("Call to TxGetMaxLength(%p, pLength=%p)\n", This, pLength);
372 return E_NOTIMPL;
373}
374
375static HRESULT __thiscall ITextHostImpl_TxGetScrollBars(ITextHost *iface, DWORD *scrollbars)
376{
378 TRACECALL("Call to TxGetScrollBars(%p, scrollbars=%p)\n", This, scrollbars);
379 *scrollbars = This->scrollbars;
380 return S_OK;
381}
382
384{
386 TRACECALL("Call to TxGetPasswordChar(%p, pch=%p)\n", This, pch);
387 return E_NOTIMPL;
388}
389
391{
393 TRACECALL("Call to TxGetAcceleratorPos(%p, pch=%p)\n", This, pch);
394 return E_NOTIMPL;
395}
396
397static HRESULT __thiscall ITextHostImpl_TxGetExtent(ITextHost *iface, LPSIZEL lpExtent)
398{
400 TRACECALL("Call to TxGetExtent(%p, lpExtent=%p)\n", This, lpExtent);
401 return E_NOTIMPL;
402}
403
405{
407 TRACECALL("Call to OnTxCharFormatChange(%p, pcf=%p)\n", This, pcf);
408 return E_NOTIMPL;
409}
410
412{
414 TRACECALL("Call to OnTxParaFormatChange(%p, ppf=%p)\n", This, ppf);
415 return E_NOTIMPL;
416}
417
418/* This must return S_OK for the native ITextServices object to
419 initialize. */
420static HRESULT __thiscall ITextHostImpl_TxGetPropertyBits(ITextHost *iface, DWORD dwMask, DWORD *pdwBits)
421{
423 TRACECALL("Call to TxGetPropertyBits(%p, dwMask=0x%08lx, pdwBits=%p)\n",
424 This, dwMask, pdwBits);
425 *pdwBits = This->props & dwMask;
426 return S_OK;
427}
428
430static int en_update_sent;
431static int en_change_sent;
433static HRESULT __thiscall ITextHostImpl_TxNotify( ITextHost *iface, DWORD code, void *data )
434{
436 TRACECALL( "Call to TxNotify(%p, code = %#lx, data = %p)\n", This, code, data );
437 switch (code)
438 {
439 case EN_VSCROLL:
441 ok( !data, "got %p\n", data );
442 break;
443 case EN_UPDATE:
445 ok( !data, "got %p\n", data );
446 break;
447 case EN_CHANGE:
450 ok( data != NULL, "got %p\n", data );
451 break;
452 case EN_SELCHANGE:
454 ok( data != NULL, "got %p\n", data );
455 break;
456 }
457 return S_OK;
458}
459
461{
463 TRACECALL("Call to TxImmGetContext(%p)\n", This);
464 return 0;
465}
466
467static void __thiscall ITextHostImpl_TxImmReleaseContext(ITextHost *iface, HIMC himc)
468{
470 TRACECALL("Call to TxImmReleaseContext(%p, himc=%p)\n", This, himc);
471}
472
473/* This function must set the variable pointed to by *lSelBarWidth.
474 Otherwise an uninitialized value will be used to calculate
475 positions and sizes even if E_NOTIMPL is returned. */
476static HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth(ITextHost *iface, LONG *lSelBarWidth)
477{
479 TRACECALL("Call to TxGetSelectionBarWidth(%p, lSelBarWidth=%p)\n",
480 This, lSelBarWidth);
481 *lSelBarWidth = 0;
482 return E_NOTIMPL;
483}
484
485static ITextHostVtbl itextHostVtbl = {
528};
529
530static void *wrapperCodeMem = NULL;
531
532#include "pshpack1.h"
533
534/* Code structure for x86 byte code */
535typedef struct
536{
537 BYTE pop_eax; /* popl %eax */
538 BYTE push_ecx; /* pushl %ecx */
539 BYTE push_eax; /* pushl %eax */
540 BYTE jmp_func; /* jmp $func */
543
544typedef struct
545{
546 BYTE pop_eax; /* popl %eax */
547 BYTE pop_ecx; /* popl %ecx */
548 BYTE push_eax; /* pushl %eax */
549 BYTE mov_vtable_eax[2]; /* movl (%ecx), %eax */
550 BYTE jmp_eax[2]; /* jmp *$vtablefunc_offset(%eax) */
553
554#include "poppack.h"
555
556static void setup_thiscall_wrappers(void)
557{
558#if defined(__i386__) && !defined(__MINGW32__) && (!defined(_MSC_VER) || !defined(__clang__))
559 void** pVtable;
560 void** pVtableEnd;
563
565 (sizeof(ITextHostVtbl)/sizeof(void*) - 3)
567 +(sizeof(ITextServicesVtbl)/sizeof(void*) - 3)
571
572 /* Wrap all ITextHostImpl methods with code to perform a thiscall to
573 * stdcall conversion. The thiscall calling convention places the This
574 * pointer in ecx on the x86 platform, and the stdcall calling convention
575 * pushes the This pointer on the stack as the first argument.
576 *
577 * The byte code does the conversion then jumps to the real function.
578 *
579 * Each wrapper needs to be modified so that the function to jump to is
580 * modified in the byte code. */
581
582 /* Skip QueryInterface, AddRef, and Release native actually
583 * defined them with the stdcall calling convention. */
584 pVtable = (void**)&itextHostVtbl + 3;
585 pVtableEnd = (void**)(&itextHostVtbl + 1);
586 while (pVtable != pVtableEnd) {
587 /* write byte code to executable memory */
588 thunk->pop_eax = 0x58; /* popl %eax */
589 thunk->push_ecx = 0x51; /* pushl %ecx */
590 thunk->push_eax = 0x50; /* pushl %eax */
591 thunk->jmp_func = 0xe9; /* jmp $func */
592 /* The address needs to be relative to the end of the jump instructions. */
593 thunk->func = (char*)*pVtable - (char*)(&thunk->func + 1);
594 *pVtable = thunk;
595 pVtable++;
596 thunk++;
597 }
598
599 /* Setup an ITextServices standard call vtable that will call the
600 * native thiscall vtable when the methods are called. */
601
602 /* QueryInterface, AddRef, and Release should be called directly on the
603 * real vtable since they use the stdcall calling convention. */
605 pVtable = (void**)&itextServicesStdcallVtbl + 3;
606 pVtableEnd = (void**)(&itextServicesStdcallVtbl + 1);
607 while (pVtable != pVtableEnd) {
608 /* write byte code to executable memory */
609 thunk2->pop_eax = 0x58; /* popl %eax */
610 thunk2->pop_ecx = 0x59; /* popl %ecx */
611 thunk2->push_eax = 0x50; /* pushl %eax */
612 thunk2->mov_vtable_eax[0] = 0x8b; /* movl (%ecx), %eax */
613 thunk2->mov_vtable_eax[1] = 0x01;
614 thunk2->jmp_eax[0] = 0xff; /* jmp *$vtablefunc_offset(%eax) */
615 thunk2->jmp_eax[1] = 0xa0;
616 thunk2->vtablefunc_offset = (char*)pVtable - (char*)&itextServicesStdcallVtbl;
617 *pVtable = thunk2;
618 pVtable++;
619 thunk2++;
620 }
621#endif /* __i386__ */
622}
623
624static void hf_to_cf(HFONT hf, CHARFORMAT2W *cf)
625{
626 LOGFONTW lf;
627
628 GetObjectW(hf, sizeof(lf), &lf);
629 lstrcpyW(cf->szFaceName, lf.lfFaceName);
630 cf->yHeight = MulDiv(abs(lf.lfHeight), 1440, GetDeviceCaps(GetDC(NULL), LOGPIXELSY));
631 if (lf.lfWeight > FW_NORMAL) cf->dwEffects |= CFE_BOLD;
632 if (lf.lfItalic) cf->dwEffects |= CFE_ITALIC;
633 if (lf.lfUnderline) cf->dwEffects |= CFE_UNDERLINE;
634 if (lf.lfStrikeOut) cf->dwEffects |= CFE_SUBSCRIPT;
635 cf->bPitchAndFamily = lf.lfPitchAndFamily;
636 cf->bCharSet = lf.lfCharSet;
637}
638
639/*************************************************************************/
640/* Conformance test functions. */
641
642/* Initialize the test texthost structure */
643static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
644{
645 ITextHostTestImpl *dummyTextHost;
646 IUnknown *init;
648 HFONT hf;
649
650 dummyTextHost = CoTaskMemAlloc(sizeof(*dummyTextHost));
651 if (dummyTextHost == NULL) {
652 win_skip("Insufficient memory to create ITextHost interface\n");
653 return FALSE;
654 }
655 dummyTextHost->ITextHost_iface.lpVtbl = &itextHostVtbl;
656 dummyTextHost->refCount = 1;
657 dummyTextHost->window = NULL;
658 SetRectEmpty( &dummyTextHost->client_rect );
659 memset(&dummyTextHost->char_format, 0, sizeof(dummyTextHost->char_format));
660 dummyTextHost->char_format.cbSize = sizeof(dummyTextHost->char_format);
661 dummyTextHost->char_format.dwMask = CFM_ALL2;
662 dummyTextHost->scrollbars = ES_AUTOVSCROLL;
663 dummyTextHost->props = 0;
665 hf_to_cf(hf, &dummyTextHost->char_format);
666
667 /* MSDN states that an IUnknown object is returned by
668 CreateTextServices which is then queried to obtain a
669 ITextServices object. */
670 result = pCreateTextServices(NULL, &dummyTextHost->ITextHost_iface, &init);
671 ok(result == S_OK, "Did not return S_OK when created (result = %lx)\n", result);
672 ok(dummyTextHost->refCount == 1, "host ref %ld\n", dummyTextHost->refCount);
673 if (result != S_OK) {
674 CoTaskMemFree(dummyTextHost);
675 win_skip("CreateTextServices failed.\n");
676 return FALSE;
677 }
678
679 result = IUnknown_QueryInterface(init, pIID_ITextServices, (void**)txtserv);
680 ok((result == S_OK) && (*txtserv != NULL), "Querying interface failed (result = %lx, txtserv = %p)\n", result, *txtserv);
681 IUnknown_Release(init);
682 if (!((result == S_OK) && (*txtserv != NULL))) {
683 CoTaskMemFree(dummyTextHost);
684 win_skip("Could not retrieve ITextServices interface\n");
685 return FALSE;
686 }
687
688 *ret = &dummyTextHost->ITextHost_iface;
689 return TRUE;
690}
691
692static void fill_reobject_struct(REOBJECT *reobj, LONG cp, LPOLEOBJECT poleobj,
693 LPSTORAGE pstg, LPOLECLIENTSITE polesite, LONG sizel_cx,
694 LONG sizel_cy, DWORD aspect, DWORD flags, DWORD user)
695{
696 reobj->cbStruct = sizeof(*reobj);
697 reobj->clsid = CLSID_NULL;
698 reobj->cp = cp;
699 reobj->poleobj = poleobj;
700 reobj->pstg = pstg;
701 reobj->polesite = polesite;
702 reobj->sizel.cx = sizel_cx;
703 reobj->sizel.cy = sizel_cy;
704 reobj->dvaspect = aspect;
705 reobj->dwFlags = flags;
706 reobj->dwUser = user;
707}
708
709static void test_TxGetText(void)
710{
711 const WCHAR *expected_string;
712 IOleClientSite *clientsite;
713 ITextServices *txtserv;
714 IRichEditOle *reole;
715 REOBJECT reobject;
716 ITextHost *host;
718 BSTR rettext;
719
720 if (!init_texthost(&txtserv, &host))
721 return;
722
723 hres = ITextServices_TxGetText(txtserv, &rettext);
724 ok(hres == S_OK, "ITextServices_TxGetText failed (result = %lx)\n", hres);
725 SysFreeString(rettext);
726
727 hres = ITextServices_TxSetText(txtserv, L"abcdefg");
728 ok(hres == S_OK, "Got hres: %#lx.\n", hres);
729 hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&reole);
730 ok(hres == S_OK, "Got hres: %#lx.\n", hres);
731 hres = IRichEditOle_GetClientSite(reole, &clientsite);
732 ok(hres == S_OK, "Got hres: %#lx.\n", hres);
733 expected_string = L"abc\xfffc""defg";
734 fill_reobject_struct(&reobject, 3, NULL, NULL, clientsite, 10, 10, DVASPECT_CONTENT, 0, 1);
735 hres = IRichEditOle_InsertObject(reole, &reobject);
736 ok(hres == S_OK, "Got hres: %#lx.\n", hres);
737 hres = ITextServices_TxGetText(txtserv, &rettext);
738 ok(hres == S_OK, "Got hres: %#lx.\n", hres);
739 ok(lstrlenW(rettext) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(rettext));
740 todo_wine ok(!lstrcmpW(rettext, expected_string), "Got wrong content: %s.\n", debugstr_w(rettext));
741 SysFreeString(rettext);
742 IOleClientSite_Release(clientsite);
743 IRichEditOle_Release(reole);
744
745 ITextServices_Release(txtserv);
746 ITextHost_Release(host);
747}
748
749static void test_TxSetText(void)
750{
751 ITextServices *txtserv;
752 ITextHost *host;
754 BSTR rettext;
755 WCHAR settext[] = {'T','e','s','t',0};
756
757 if (!init_texthost(&txtserv, &host))
758 return;
759
760 hres = ITextServices_TxSetText(txtserv, settext);
761 ok(hres == S_OK, "ITextServices_TxSetText failed (result = %lx)\n", hres);
762
763 hres = ITextServices_TxGetText(txtserv, &rettext);
764 ok(hres == S_OK, "ITextServices_TxGetText failed (result = %lx)\n", hres);
765
766 ok(SysStringLen(rettext) == 4,
767 "String returned of wrong length (expected 4, got %d)\n", SysStringLen(rettext));
768 ok(memcmp(rettext,settext,SysStringByteLen(rettext)) == 0,
769 "String returned differs\n");
770
771 SysFreeString(rettext);
772
773 /* Null-pointer should behave the same as empty-string */
774
775 hres = ITextServices_TxSetText(txtserv, 0);
776 ok(hres == S_OK, "ITextServices_TxSetText failed (result = %lx)\n", hres);
777
778 hres = ITextServices_TxGetText(txtserv, &rettext);
779 ok(hres == S_OK, "ITextServices_TxGetText failed (result = %lx)\n", hres);
780 ok(SysStringLen(rettext) == 0,
781 "String returned of wrong length (expected 0, got %d)\n", SysStringLen(rettext));
782
783 SysFreeString(rettext);
784 ITextServices_Release(txtserv);
785 ITextHost_Release(host);
786}
787
788#define CHECK_TXGETNATURALSIZE(res,width,height,hdc,rect,string) \
789 _check_txgetnaturalsize(res, width, height, hdc, rect, string, __LINE__)
791{
793 LONG expected_width, expected_height;
794
796 expected_width = expected_rect.right - expected_rect.left;
797 expected_height = expected_rect.bottom - expected_rect.top;
798 ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08lx.\n", res);
799 todo_wine ok_(__FILE__,line)(width >= expected_width && width <= expected_width + 1,
800 "got wrong width: %ld, expected: %ld {+1}.\n", width, expected_width);
801 ok_(__FILE__,line)(height == expected_height, "got wrong height: %ld, expected: %ld.\n",
802 height, expected_height);
803}
804
805static void test_TxGetNaturalSize(void)
806{
807 ITextServices *txtserv;
808 ITextHost *host;
811 static const WCHAR test_text[] = L"TestSomeText";
813 HDC hdcDraw;
814 HWND hwnd;
815 RECT rect;
817 LRESULT lresult;
818 HFONT hf;
819
820 if (!init_texthost(&txtserv, &host))
821 return;
822
823 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
824 0, 0, 100, 100, 0, 0, 0, NULL);
825 hdcDraw = GetDC(hwnd);
826 SetMapMode(hdcDraw,MM_TEXT);
828
829 memset(&cf, 0, sizeof(cf));
830 cf.cbSize = sizeof(cf);
831 cf.dwMask = CFM_ALL2;
833 hf_to_cf(hf, &cf);
835 ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08lx.\n", result);
836 SelectObject(hdcDraw, hf);
837
838 result = ITextServices_TxSetText(txtserv, test_text);
839 ok(result == S_OK, "ITextServices_TxSetText failed: 0x%08lx.\n", result);
840
841 extent.cx = -1; extent.cy = -1;
842 width = rect.right - rect.left;
843 height = 0;
844 result = ITextServices_TxGetNaturalSize(txtserv, DVASPECT_CONTENT, hdcDraw, NULL, NULL,
846 CHECK_TXGETNATURALSIZE(result, width, height, hdcDraw, rect, test_text);
847
848 ReleaseDC(hwnd, hdcDraw);
850 ITextServices_Release(txtserv);
851 ITextHost_Release(host);
852}
853
854static void test_TxDraw(void)
855{
856 ITextServices *txtserv;
857 ITextDocument *txtdoc;
858 ITextHost *host;
859 HRESULT hr;
860 RECT client = {0, 0, 100, 100};
861 ITextHostTestImpl *host_impl;
862 LONG freeze_count;
863 HDC hdc;
864
865 if (!init_texthost(&txtserv, &host))
866 return;
867
868 hr = ITextServices_QueryInterface( txtserv, &IID_ITextDocument, (void **)&txtdoc );
869 ok( hr == S_OK, "ITextServices_QueryInterface (ITextDocument) returned %#lx\n", hr );
870
871 host_impl = impl_from_ITextHost( host );
872 host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP | WS_VISIBLE,
873 0, 0, 400, 400, 0, 0, 0, NULL );
874 host_impl->client_rect = client;
877 host_impl->props );
878 hdc = GetDC( host_impl->window );
879
880 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
882 ok( hr == E_INVALIDARG, "got %08lx\n", hr );
883 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, NULL, NULL,
885 ok( hr == E_INVALIDARG, "got %08lx\n", hr );
886 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, (RECTL *)&client, NULL,
888 ok( hr == E_FAIL, "got %08lx\n", hr );
889 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
891 ok( hr == S_OK, "got %08lx\n", hr );
892 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
893 NULL, NULL, 0, TXTVIEW_ACTIVE );
894 ok( hr == S_OK, "got %08lx\n", hr );
895
897 ok( hr == S_OK, "got %08lx\n", hr );
898
899 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
901 ok( hr == S_OK, "got %08lx\n", hr );
902
903 freeze_count = 0xdeadbeef;
904 hr = ITextDocument_Freeze( txtdoc, &freeze_count );
905 ok( hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr );
906 ok( freeze_count == 1, "expected count to be %d, got %ld\n", 1, freeze_count );
907
908 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
910 ok( hr == S_OK, "got %08lx\n", hr );
911 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
912 NULL, NULL, 0, TXTVIEW_ACTIVE );
913 ok( hr == E_UNEXPECTED, "got %08lx\n", hr );
914
915 freeze_count = 0xdeadbeef;
916 hr = ITextDocument_Unfreeze( txtdoc, &freeze_count );
917 ok( hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr );
918 ok( freeze_count == 0, "expected count to be %d, got %ld\n", 0, freeze_count );
919
921
922 ReleaseDC( host_impl->window, hdc );
923 ITextDocument_Release(txtdoc);
924 ITextServices_Release(txtserv);
925 DestroyWindow( host_impl->window );
926 ITextHost_Release(host);
927}
928
929DEFINE_GUID(expected_iid_itextservices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
930DEFINE_GUID(expected_iid_itexthost, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
931DEFINE_GUID(expected_iid_itexthost2, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
932
933static void test_IIDs(void)
934{
935 ok(IsEqualIID(pIID_ITextServices, &expected_iid_itextservices),
936 "unexpected value for IID_ITextServices: %s\n", wine_dbgstr_guid(pIID_ITextServices));
937 ok(IsEqualIID(pIID_ITextHost, &expected_iid_itexthost),
938 "unexpected value for IID_ITextHost: %s\n", wine_dbgstr_guid(pIID_ITextHost));
939 ok(IsEqualIID(pIID_ITextHost2, &expected_iid_itexthost2),
940 "unexpected value for IID_ITextHost2: %s\n", wine_dbgstr_guid(pIID_ITextHost2));
941}
942
943/* Outer IUnknown for COM aggregation tests */
944struct unk_impl {
946 LONG ref;
948};
949
950static inline struct unk_impl *impl_from_IUnknown(IUnknown *iface)
951{
952 return CONTAINING_RECORD(iface, struct unk_impl, IUnknown_iface);
953}
954
956{
957 struct unk_impl *This = impl_from_IUnknown(iface);
958
959 return IUnknown_QueryInterface(This->inner_unk, riid, ppv);
960}
961
963{
964 struct unk_impl *This = impl_from_IUnknown(iface);
965
966 return InterlockedIncrement(&This->ref);
967}
968
970{
971 struct unk_impl *This = impl_from_IUnknown(iface);
972
973 return InterlockedDecrement(&This->ref);
974}
975
976static const IUnknownVtbl unk_vtbl =
977{
981};
982
983static void test_COM(void)
984{
985 struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL};
986 struct ITextHostTestImpl texthost = {{&itextHostVtbl}, 1};
987 ITextServices *textsrv;
988 ULONG refcount;
989 HRESULT hr;
990
991 /* COM aggregation */
993 &unk_obj.inner_unk);
994 ok(hr == S_OK, "CreateTextServices failed: %08lx\n", hr);
995 hr = IUnknown_QueryInterface(unk_obj.inner_unk, pIID_ITextServices, (void**)&textsrv);
996 ok(hr == S_OK, "QueryInterface for IID_ITextServices failed: %08lx\n", hr);
997 refcount = ITextServices_AddRef(textsrv);
998 ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
999 refcount = ITextServices_Release(textsrv);
1000 ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
1001 refcount = ITextServices_Release(textsrv);
1002 ok(refcount == 19, "Refcount should be back at 19 but is %lu\n", refcount);
1003
1004 IUnknown_Release(unk_obj.inner_unk);
1005}
1006
1008{
1009 IUnknown_AddRef(iface);
1010 return IUnknown_Release(iface);
1011}
1012
1013static void test_QueryInterface(void)
1014{
1015 ITextServices *txtserv;
1016 ITextHost *host;
1017 HRESULT hres;
1018 IRichEditOle *reole, *txtsrv_reole;
1019 ITextDocument *txtdoc, *txtsrv_txtdoc;
1020 ITextDocument2Old *txtdoc2old, *txtsrv_txtdoc2old;
1021 IUnknown *unk, *unk2;
1022 ULONG refcount;
1023
1024 if(!init_texthost(&txtserv, &host))
1025 return;
1026
1027 refcount = get_refcount((IUnknown *)txtserv);
1028 ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
1029
1030 /* IID_IRichEditOle */
1031 hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&txtsrv_reole);
1032 ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08lx\n", hres);
1033 refcount = get_refcount((IUnknown *)txtserv);
1034 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1035 refcount = get_refcount((IUnknown *)txtsrv_reole);
1036 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1037
1038 hres = ITextServices_QueryInterface( txtserv, &IID_IUnknown, (void **)&unk );
1039 ok( hres == S_OK, "got 0x%08lx\n", hres );
1040 hres = IRichEditOle_QueryInterface( txtsrv_reole, &IID_IUnknown, (void **)&unk2 );
1041 ok( hres == S_OK, "got 0x%08lx\n", hres );
1042 ok( unk == unk2, "unknowns differ\n" );
1043 IUnknown_Release( unk2 );
1044 IUnknown_Release( unk );
1045
1046 hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument, (void **)&txtdoc);
1047 ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08lx\n", hres);
1048 refcount = get_refcount((IUnknown *)txtserv);
1049 ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
1050 refcount = get_refcount((IUnknown *)txtsrv_reole);
1051 ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
1052
1053 ITextDocument_Release(txtdoc);
1054 refcount = get_refcount((IUnknown *)txtserv);
1055 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1056
1057 hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument2Old, (void **)&txtdoc2old);
1058 ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08lx\n", hres);
1059 refcount = get_refcount((IUnknown *)txtserv);
1060 ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
1061 refcount = get_refcount((IUnknown *)txtsrv_reole);
1062 ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
1063
1064 ITextDocument2Old_Release(txtdoc2old);
1065 refcount = get_refcount((IUnknown *)txtserv);
1066 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1067 IRichEditOle_Release(txtsrv_reole);
1068 refcount = get_refcount((IUnknown *)txtserv);
1069 ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
1070
1071 /* IID_ITextDocument */
1072 hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument, (void **)&txtsrv_txtdoc);
1073 ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08lx\n", hres);
1074 refcount = get_refcount((IUnknown *)txtserv);
1075 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1076 refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
1077 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1078
1079 hres = ITextDocument_QueryInterface(txtsrv_txtdoc, &IID_IRichEditOle, (void **)&reole);
1080 ok(hres == S_OK, "ITextDocument_QueryInterface: 0x%08lx\n", hres);
1081 refcount = get_refcount((IUnknown *)txtserv);
1082 ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
1083 refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
1084 ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
1085
1086 IRichEditOle_Release(reole);
1087 refcount = get_refcount((IUnknown *)txtserv);
1088 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1089 ITextDocument_Release(txtsrv_txtdoc);
1090 refcount = get_refcount((IUnknown *)txtserv);
1091 ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
1092
1093 /* ITextDocument2Old */
1094 hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument2Old, (void **)&txtsrv_txtdoc2old);
1095 ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08lx\n", hres);
1096 refcount = get_refcount((IUnknown *)txtserv);
1097 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1098 refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
1099 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1100
1101 hres = ITextDocument2Old_QueryInterface(txtsrv_txtdoc2old, &IID_IRichEditOle, (void **)&reole);
1102 ok(hres == S_OK, "ITextDocument2Old_QueryInterface: 0x%08lx\n", hres);
1103 refcount = get_refcount((IUnknown *)txtserv);
1104 ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
1105 refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
1106 ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
1107
1108 IRichEditOle_Release(reole);
1109 refcount = get_refcount((IUnknown *)txtserv);
1110 ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
1111 ITextDocument2Old_Release(txtsrv_txtdoc2old);
1112 refcount = get_refcount((IUnknown *)txtserv);
1113 ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
1114
1115 ITextServices_Release(txtserv);
1116 ITextHost_Release(host);
1117}
1118
1119static void test_default_format(void)
1120{
1121 ITextServices *txtserv;
1122 ITextHost *host;
1124 LRESULT lresult;
1125 CHARFORMAT2W cf2;
1126 const CHARFORMATW *host_cf;
1127 DWORD expected_effects;
1128
1129 if (!init_texthost(&txtserv, &host))
1130 return;
1131
1132 cf2.cbSize = sizeof(CHARFORMAT2W);
1134 ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08lx.\n", result);
1135
1137 ok(!lstrcmpW(host_cf->szFaceName, cf2.szFaceName), "got wrong font name: %s.\n", wine_dbgstr_w(cf2.szFaceName));
1138 ok(cf2.yHeight == host_cf->yHeight, "got wrong yHeight: %ld, expected %ld.\n", cf2.yHeight, host_cf->yHeight);
1139 expected_effects = (cf2.dwEffects & ~(CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR));
1140 ok(host_cf->dwEffects == expected_effects, "got wrong dwEffects: %lx, expected %lx.\n", cf2.dwEffects, expected_effects);
1141 ok(cf2.bPitchAndFamily == host_cf->bPitchAndFamily, "got wrong bPitchAndFamily: %x, expected %x.\n",
1142 cf2.bPitchAndFamily, host_cf->bPitchAndFamily);
1143 ok(cf2.bCharSet == host_cf->bCharSet, "got wrong bCharSet: %x, expected %x.\n", cf2.bCharSet, host_cf->bCharSet);
1144
1145 ITextServices_Release(txtserv);
1146 ITextHost_Release(host);
1147}
1148
1149static void test_TxGetScroll(void)
1150{
1151 ITextServices *txtserv;
1152 ITextHost *host;
1153 HRESULT ret;
1154 LONG min_pos, max_pos, pos, page;
1155 BOOL enabled;
1156 ITextHostTestImpl *host_impl;
1157 RECT client = {0, 0, 100, 100};
1158
1159 if (!init_texthost(&txtserv, &host))
1160 return;
1161
1162 host_impl = impl_from_ITextHost( host );
1163
1165 ok(ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret);
1166
1168 ok(ret == S_OK, "ITextServices_TxGetVScroll failed: 0x%08lx.\n", ret);
1169
1170 ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
1171 ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
1172 ok( min_pos == 0, "got %ld\n", min_pos );
1173 ok( max_pos == 0, "got %ld\n", max_pos );
1174 ok( pos == 0, "got %ld\n", pos );
1175 ok( page == 0, "got %ld\n", page );
1176 ok( !enabled, "got %d\n", enabled );
1177
1178 host_impl->scrollbars = WS_VSCROLL;
1181
1182 host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP | WS_VISIBLE,
1183 0, 0, 400, 400, 0, 0, 0, NULL );
1184 host_impl->client_rect = client;
1186 ok( ret == S_OK, "got 0x%08lx.\n", ret );
1187
1188 ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
1189 ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
1190 ok( min_pos == 0, "got %ld\n", min_pos );
1191 todo_wine
1192 ok( max_pos == 0, "got %ld\n", max_pos );
1193 ok( pos == 0, "got %ld\n", pos );
1194 ok( page == client.bottom, "got %ld\n", page );
1195 ok( !enabled, "got %d\n", enabled );
1196
1197 ret = ITextServices_TxSetText( txtserv, lorem );
1198 ok( ret == S_OK, "got 0x%08lx.\n", ret );
1199
1200 ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
1201 ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
1202 ok( min_pos == 0, "got %ld\n", min_pos );
1203 ok( max_pos > client.bottom, "got %ld\n", max_pos );
1204 ok( pos == 0, "got %ld\n", pos );
1205 ok( page == client.bottom, "got %ld\n", page );
1206 ok( enabled, "got %d\n", enabled );
1207
1210 ITextServices_TxSetText( txtserv, L"short" );
1211
1212 ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
1213 ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
1214 ok( min_pos == 0, "got %ld\n", min_pos );
1215 todo_wine
1216 ok( max_pos == 0, "got %ld\n", max_pos );
1217 ok( pos == 0, "got %ld\n", pos );
1218 ok( page == client.bottom, "got %ld\n", page );
1219 ok( !enabled, "got %d\n", enabled );
1220
1221 DestroyWindow( host_impl->window );
1222 ITextServices_Release(txtserv);
1223 ITextHost_Release(host);
1224}
1225
1226static void test_notifications( void )
1227{
1228 ITextServices *txtserv;
1229 ITextHost *host;
1230 LRESULT res;
1231 HRESULT hr;
1232 RECT client = { 0, 0, 100, 100 };
1233 ITextHostTestImpl *host_impl;
1234
1235 init_texthost( &txtserv, &host );
1236 host_impl = impl_from_ITextHost( host );
1237
1238 host_impl->scrollbars = WS_VSCROLL;
1241
1242 ITextServices_TxSetText( txtserv, lorem );
1243
1244 host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP | WS_VISIBLE,
1245 0, 0, 400, 400, 0, 0, 0, NULL );
1246 host_impl->client_rect = client;
1248 ok( hr == S_OK, "got 0x%08lx.\n", hr );
1249
1251 ok( hr == S_OK, "got %08lx\n", hr );
1252
1253 /* check EN_VSCROLL notification is sent */
1254 en_vscroll_sent = 0;
1256 ok( hr == S_OK, "got %08lx\n", hr );
1257 ok( en_vscroll_sent == 1, "got %d\n", en_vscroll_sent );
1258
1260 ok( hr == S_OK, "got %08lx\n", hr );
1261 ok( en_vscroll_sent == 2, "got %d\n", en_vscroll_sent );
1262
1263 /* but not when the thumb is moved */
1265 ok( hr == S_OK, "got %08lx\n", hr );
1267 ok( hr == S_OK, "got %08lx\n", hr );
1268 ok( en_vscroll_sent == 2, "got %d\n", en_vscroll_sent );
1269
1270 /* EN_UPDATE is sent by TxDraw() */
1271 en_update_sent = 0;
1272 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
1273 NULL, NULL, 0, TXTVIEW_ACTIVE );
1274 ok( hr == S_OK, "got %08lx\n", hr );
1275 ok( en_update_sent == 1, "got %d\n", en_update_sent );
1276
1277 DestroyWindow( host_impl->window );
1278 ITextServices_Release( txtserv );
1279 ITextHost_Release( host );
1280}
1281
1283{
1284 ITextServices *txtserv;
1285 ITextHost *host;
1288 HRESULT hr;
1289
1290 if (!init_texthost(&txtserv, &host))
1291 return;
1292
1293 ITextServices_TxSetText(txtserv, L"");
1294
1295 if (winetest_debug > 1) trace("TxSendMessage EM_SETEVENTMASK");
1296
1298 ok( hr == S_OK, "got %08lx\n", hr );
1299
1300 if (winetest_debug > 1) trace("TxSendMessage EM_SETSEL 0 20");
1301
1303 en_change_sent = 0;
1305
1306 hr = ITextServices_TxSendMessage(txtserv, EM_SETSEL, 0, 20, &result);
1307 ok( hr == S_OK, "got %08lx\n", hr );
1308
1310 ok(en_change_sent == 0, "got %d\n", en_change_sent);
1311 todo_wine
1312 ok(en_selchange_sent == 0, "got %d\n", en_selchange_sent);
1313
1314 hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
1315
1316 if (winetest_debug > 1) trace("TxSendMessage EM_SETSELEX 0 20");
1317
1319 en_change_sent = 0;
1321
1322 range.cpMin = 0;
1323 range.cpMax = 20;
1325 ok( hr == S_OK, "got %08lx\n", hr );
1326
1328 ok(en_change_sent == 0, "got %d\n", en_change_sent);
1329 ok(en_selchange_sent == 0, "got %d\n", en_selchange_sent);
1330
1331 if (winetest_debug > 1) trace("TxSetText");
1332
1334 en_change_sent = 0;
1336
1337 hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
1338
1340
1341 hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
1342
1344 ok(en_change_sent == 1, "got %d\n", en_change_sent);
1345 todo_wine
1346 ok(en_selchange_sent == 0, "got %d\n", en_selchange_sent);
1347
1348 if (winetest_debug > 1) trace("TxSendMessage EM_SETSEL 0 20");
1349
1351 en_change_sent = 0;
1353
1354 hr = ITextServices_TxSendMessage(txtserv, EM_SETSEL, 0, 20, &result);
1355 ok( hr == S_OK, "got %08lx\n", hr );
1356
1358 ok(en_change_sent == 0, "got %d\n", en_change_sent);
1359 ok(en_selchange_sent == 1, "got %d\n", en_selchange_sent);
1360
1361 hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
1362
1363 if (winetest_debug > 1) trace("TxSendMessage EM_SETSELEX 0 20");
1364
1366 en_change_sent = 0;
1368
1369 range.cpMin = 0;
1370 range.cpMax = 20;
1372 ok( hr == S_OK, "got %08lx\n", hr );
1373
1375 ok(en_change_sent == 0, "got %d\n", en_change_sent);
1376 ok(en_selchange_sent == 0, "got %d\n", en_selchange_sent);
1377
1378 hr = ITextServices_TxSendMessage(txtserv, EM_EXGETSEL, 0, (LPARAM)&range, &result); ok( hr == S_OK, "got %08lx\n", hr ); trace("getsel: %lu, %lu\n", range.cpMin, range.cpMax);
1379
1380 if (winetest_debug > 1) trace("release interfaces");
1381
1382 ITextServices_Release( txtserv );
1383 ITextHost_Release( host );
1384}
1385
1386static void test_scrollcaret( void )
1387{
1388 ITextServices *txtserv;
1389 ITextHost *host;
1391 HRESULT hr;
1392
1393 if (!init_texthost(&txtserv, &host))
1394 return;
1395
1397 ok( hr == S_OK, "got %08lx\n", hr );
1398
1399 ITextServices_Release( txtserv );
1400 ITextHost_Release( host );
1401}
1402
1403static void test_inplace_active( BOOL active )
1404{
1405 ITextServices *txtserv;
1406 ITextHost *host;
1408 HRESULT hr;
1409
1410 ITextHostTestImpl *host_impl;
1411 if (!init_texthost(&txtserv, &host))
1412 return;
1413
1414 host_impl = impl_from_ITextHost( host );
1415 host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100, 0, 0, 0, NULL );
1416 host_impl->client_rect = (RECT) { 0, 0, 150, 150 };
1417 host_impl->scrollbars = WS_VSCROLL | ES_AUTOVSCROLL;
1420
1423
1424 if (active) {
1425 hr = ITextServices_OnTxInPlaceActivate( txtserv, &host_impl->client_rect );
1426 ok( hr == S_OK, "got %08lx\n", hr );
1427 }
1428
1430 ok( hr == S_OK, "got %08lx\n", hr );
1431
1432 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, GetDC(host_impl->window), NULL, (RECTL *)&host_impl->client_rect, NULL, NULL, NULL, 0, TXTVIEW_INACTIVE );
1433 ok( hr == S_OK, "got %08lx\n", hr );
1434
1435 hr = ITextServices_TxSendMessage(txtserv, EM_SETSEL, 0, -1, &result);
1436 ok( hr == S_OK, "got %08lx\n", hr );
1437
1439 ok( hr == S_OK, "got %08lx\n", hr );
1440
1441 hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, GetDC(host_impl->window), NULL, (RECTL *)&host_impl->client_rect, NULL, NULL, NULL, 0, TXTVIEW_INACTIVE );
1442 ok( hr == S_OK, "got %08lx\n", hr );
1443
1444 if (active) {
1447 } else {
1450 }
1451
1452 DestroyWindow( host_impl->window );
1453 ITextServices_Release( txtserv );
1454 ITextHost_Release( host );
1455}
1456
1457START_TEST( txtsrv )
1458{
1459 ITextServices *txtserv;
1460 ITextHost *host;
1461
1463
1464 /* Must explicitly LoadLibrary(). The test has no references to functions in
1465 * RICHED20.DLL, so the linker doesn't actually link to it. */
1466 hmoduleRichEdit = LoadLibraryA("riched20.dll");
1467 ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
1468
1469 pIID_ITextServices = (IID*)GetProcAddress(hmoduleRichEdit, "IID_ITextServices");
1470 pIID_ITextHost = (IID*)GetProcAddress(hmoduleRichEdit, "IID_ITextHost");
1471 pIID_ITextHost2 = (IID*)GetProcAddress(hmoduleRichEdit, "IID_ITextHost2");
1472 pCreateTextServices = (void*)GetProcAddress(hmoduleRichEdit, "CreateTextServices");
1473
1474 test_IIDs();
1475 test_COM();
1476
1477 if (init_texthost(&txtserv, &host))
1478 {
1479 ITextServices_Release(txtserv);
1480 ITextHost_Release(host);
1481
1485 test_TxDraw();
1494 }
1496}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
void user(int argc, const char *argv[])
Definition: cmds.c:1350
const GUID IID_IUnknown
HBITMAP hbmp
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
DWORD HIMC
Definition: dimm.idl:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
OLECHAR * BSTR
Definition: compat.h:2293
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
static struct text_services * impl_from_IUnknown(IUnknown *iface)
Definition: txtsrv.c:36
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define ITextServices_TxSetText(This, a)
Definition: editor.h:425
#define ITextServices_TxDraw(This, a, b, c, d, e, f, g, h, i, j, k, l)
Definition: editor.h:415
#define ITextServices_OnTxInPlaceDeactivate(This)
Definition: editor.h:421
#define ITextServices_TxSendMessage(This, a, b, c, d)
Definition: editor.h:414
#define ITextServices_OnTxInPlaceActivate(This, a)
Definition: editor.h:420
#define ITextServices_TxGetHScroll(This, a, b, c, d, e)
Definition: editor.h:416
#define ITextServices_TxGetVScroll(This, a, b, c, d, e)
Definition: editor.h:417
#define ITextServices_OnTxPropertyBitsChange(This, a, b)
Definition: editor.h:430
#define ITextServices_TxGetText(This, a)
Definition: editor.h:424
#define ITextServices_TxGetNaturalSize(This, a, b, c, d, e, f, g, h)
Definition: editor.h:428
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
GLuint res
Definition: glext.h:9613
GLenum GLint * range
Definition: glext.h:7539
GLbitfield flags
Definition: glext.h:7161
GLuint64EXT * result
Definition: glext.h:11304
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_w
Definition: kernel32.h:32
#define wine_dbgstr_w
Definition: kernel32.h:34
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
POINT cp
Definition: magnifier.c:59
#define pch(ap)
Definition: match.c:418
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HRESULT hres
Definition: protocol.c:465
#define todo_wine
Definition: custom.c:89
#define __thiscall
Definition: cpp.c:43
static IID * pIID_ITextServices
Definition: txtsrv.c:63
#define INCREASE_CALL_COUNTER(func)
Definition: txtsrv.c:44
static HRESULT __thiscall ITextHostImpl_TxGetMaxLength(ITextHost *iface, DWORD *pLength)
Definition: txtsrv.c:368
static HRESULT __thiscall ITextHostImpl_TxGetViewInset(ITextHost *iface, LPRECT prc)
Definition: txtsrv.c:332
static HRESULT __thiscall ITextHostImpl_OnTxCharFormatChange(ITextHost *iface, const CHARFORMATW *pcf)
Definition: txtsrv.c:404
#define CLEAR_COUNTER(func)
Definition: txtsrv.c:59
#define CHECK_TXGETNATURALSIZE(res, width, height, hdc, rect, string)
Definition: txtsrv.c:788
static COLORREF __thiscall ITextHostImpl_TxGetSysColor(ITextHost *iface, int nIndex)
Definition: txtsrv.c:354
static void test_TxGetNaturalSize(void)
Definition: txtsrv.c:805
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)
Definition: txtsrv.c:692
static INT __thiscall ITextHostImpl_TxReleaseDC(ITextHost *iface, HDC hdc)
Definition: txtsrv.c:173
static BOOL __thiscall ITextHostImpl_TxScreenToClient(ITextHost *iface, LPPOINT lppt)
Definition: txtsrv.c:295
static HRESULT __thiscall ITextHostImpl_TxGetExtent(ITextHost *iface, LPSIZEL lpExtent)
Definition: txtsrv.c:397
static void test_notifications(void)
Definition: txtsrv.c:1226
static IID * pIID_ITextHost
Definition: txtsrv.c:64
static HRESULT __thiscall ITextHostImpl_TxGetPropertyBits(ITextHost *iface, DWORD dwMask, DWORD *pdwBits)
Definition: txtsrv.c:420
static void test_inplace_active(BOOL active)
Definition: txtsrv.c:1403
static HRESULT __thiscall ITextHostImpl_TxGetPasswordChar(ITextHost *iface, WCHAR *pch)
Definition: txtsrv.c:383
static int en_selchange_sent
Definition: txtsrv.c:432
static HMODULE hmoduleRichEdit
Definition: txtsrv.c:62
static HRESULT __thiscall ITextHostImpl_TxDeactivate(ITextHost *iface, LONG lNewState)
Definition: txtsrv.c:316
static const WCHAR lorem[]
Definition: txtsrv.c:124
static HRESULT __thiscall ITextHostImpl_TxActivate(ITextHost *iface, LONG *plOldState)
Definition: txtsrv.c:309
static BOOL __thiscall ITextHostImpl_TxShowScrollBar(ITextHost *iface, INT fnBar, BOOL fShow)
Definition: txtsrv.c:181
static void __thiscall ITextHostImpl_TxSetCapture(ITextHost *iface, BOOL fCapture)
Definition: txtsrv.c:276
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:643
static BOOL __thiscall ITextHostImpl_TxClientToScreen(ITextHost *iface, LPPOINT lppt)
Definition: txtsrv.c:302
static int en_change_sent
Definition: txtsrv.c:431
static int en_update_sent
Definition: txtsrv.c:430
static HIMC __thiscall ITextHostImpl_TxImmGetContext(ITextHost *iface)
Definition: txtsrv.c:460
static BOOL __thiscall ITextHostImpl_TxCreateCaret(ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight)
Definition: txtsrv.c:229
static BOOL __thiscall ITextHostImpl_TxSetScrollPos(ITextHost *iface, INT fnBar, INT nPos, BOOL fRedraw)
Definition: txtsrv.c:206
#define DEFINE_EXPECT(func)
Definition: txtsrv.c:41
static HRESULT __thiscall ITextHostImpl_TxGetBackStyle(ITextHost *iface, TXTBACKSTYLE *pStyle)
Definition: txtsrv.c:361
static ULONG WINAPI unk_Release(IUnknown *iface)
Definition: txtsrv.c:969
static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface)
Definition: txtsrv.c:151
static void test_TxSetText(void)
Definition: txtsrv.c:749
static HRESULT WINAPI unk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: txtsrv.c:955
static void test_set_selection_message(void)
Definition: txtsrv.c:1282
static HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos(ITextHost *iface, LONG *pch)
Definition: txtsrv.c:390
static void setup_thiscall_wrappers(void)
Definition: txtsrv.c:556
static HDC __thiscall ITextHostImpl_TxGetDC(ITextHost *iface)
Definition: txtsrv.c:165
static BOOL __thiscall ITextHostImpl_TxSetTimer(ITextHost *iface, UINT idTimer, UINT uTimeout)
Definition: txtsrv.c:252
static HRESULT __thiscall ITextHostImpl_TxGetParaFormat(ITextHost *iface, const PARAFORMAT **ppPF)
Definition: txtsrv.c:347
static void test_QueryInterface(void)
Definition: txtsrv.c:1013
static void __thiscall ITextHostImpl_TxImmReleaseContext(ITextHost *iface, HIMC himc)
Definition: txtsrv.c:467
static void __thiscall ITextHostImpl_TxKillTimer(ITextHost *iface, UINT idTimer)
Definition: txtsrv.c:260
static void test_TxGetText(void)
Definition: txtsrv.c:709
static void test_TxDraw(void)
Definition: txtsrv.c:854
static HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth(ITextHost *iface, LONG *lSelBarWidth)
Definition: txtsrv.c:476
static void hf_to_cf(HFONT hf, CHARFORMAT2W *cf)
Definition: txtsrv.c:624
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:119
static ULONG WINAPI unk_AddRef(IUnknown *iface)
Definition: txtsrv.c:962
static BOOL __thiscall ITextHostImpl_TxEnableScrollBar(ITextHost *iface, INT fuSBFlags, INT fuArrowflags)
Definition: txtsrv.c:189
static HRESULT __thiscall ITextHostImpl_TxGetScrollBars(ITextHost *iface, DWORD *scrollbars)
Definition: txtsrv.c:375
static int en_vscroll_sent
Definition: txtsrv.c:429
static BOOL __thiscall ITextHostImpl_TxSetCaretPos(ITextHost *iface, INT x, INT y)
Definition: txtsrv.c:245
#define TRACECALL
Definition: txtsrv.c:100
static void test_TxGetScroll(void)
Definition: txtsrv.c:1149
static HRESULT __thiscall ITextHostImpl_TxGetCharFormat(ITextHost *iface, const CHARFORMATW **ppCF)
Definition: txtsrv.c:339
static HRESULT __thiscall ITextHostImpl_TxGetClientRect(ITextHost *iface, LPRECT prc)
Definition: txtsrv.c:323
#define CHECK_CALLED(func)
Definition: txtsrv.c:49
static const IUnknownVtbl unk_vtbl
Definition: txtsrv.c:976
static HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange(ITextHost *iface, const PARAFORMAT *ppf)
Definition: txtsrv.c:411
static BOOL __thiscall ITextHostImpl_TxSetScrollRange(ITextHost *iface, INT fnBar, LONG nMinPos, INT nMaxPos, BOOL fRedraw)
Definition: txtsrv.c:197
static HRESULT WINAPI ITextHostImpl_QueryInterface(ITextHost *iface, REFIID riid, LPVOID *ppvObject)
Definition: txtsrv.c:129
static void * wrapperCodeMem
Definition: txtsrv.c:530
static ULONG WINAPI ITextHostImpl_AddRef(ITextHost *iface)
Definition: txtsrv.c:144
static void __thiscall ITextHostImpl_TxSetCursor(ITextHost *iface, HCURSOR hcur, BOOL fText)
Definition: txtsrv.c:288
static void __thiscall ITextHostImpl_TxInvalidateRect(ITextHost *iface, LPCRECT prc, BOOL fMode)
Definition: txtsrv.c:214
static BOOL __thiscall ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow)
Definition: txtsrv.c:237
static void test_scrollcaret(void)
Definition: txtsrv.c:1386
static void __thiscall ITextHostImpl_TxScrollWindowEx(ITextHost *iface, INT dx, INT dy, LPCRECT lprcScroll, LPCRECT lprcClip, HRGN hRgnUpdate, LPRECT lprcUpdate, UINT fuScroll)
Definition: txtsrv.c:266
static void test_default_format(void)
Definition: txtsrv.c:1119
static void __thiscall ITextHostImpl_TxViewChange(ITextHost *iface, BOOL fUpdate)
Definition: txtsrv.c:221
static void _check_txgetnaturalsize(HRESULT res, LONG width, LONG height, HDC hdc, RECT rect, LPCWSTR string, int line)
Definition: txtsrv.c:790
static HRESULT __thiscall ITextHostImpl_TxNotify(ITextHost *iface, DWORD code, void *data)
Definition: txtsrv.c:433
static PCreateTextServices pCreateTextServices
Definition: txtsrv.c:66
static void __thiscall ITextHostImpl_TxSetFocus(ITextHost *iface)
Definition: txtsrv.c:282
static IID * pIID_ITextHost2
Definition: txtsrv.c:65
#define CHECK_NOT_CALLED(func)
Definition: txtsrv.c:54
static ITextHostVtbl itextHostVtbl
Definition: txtsrv.c:485
static void test_IIDs(void)
Definition: txtsrv.c:933
static void test_COM(void)
Definition: txtsrv.c:983
static ULONG get_refcount(IUnknown *iface)
Definition: txtsrv.c:1007
static RECT expected_rect
Definition: win.c:5821
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
unsigned int UINT
Definition: ndis.h:50
#define MEM_RELEASE
Definition: nt_native.h:1316
#define MEM_COMMIT
Definition: nt_native.h:1313
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
_Out_ LPRECT prc
Definition: ntgdi.h:1658
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
interface IStorage * LPSTORAGE
Definition: objfwd.h:30
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:215
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
long LONG
Definition: pedump.c:60
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define CLSID_NULL
Definition: guiddef.h:99
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define ENM_CHANGE
Definition: richedit.h:468
#define EM_SCROLLCARET
Definition: richedit.h:81
#define CFE_BOLD
Definition: richedit.h:406
#define ENM_SCROLL
Definition: richedit.h:470
#define CFE_AUTOCOLOR
Definition: richedit.h:414
#define EM_SETEVENTMASK
Definition: richedit.h:102
#define CFE_ITALIC
Definition: richedit.h:407
#define SCF_DEFAULT
Definition: richedit.h:234
#define EM_GETCHARFORMAT
Definition: richedit.h:91
#define EN_SELCHANGE
Definition: richedit.h:193
#define EM_SETCHARFORMAT
Definition: richedit.h:101
#define ENM_SELCHANGE
Definition: richedit.h:478
#define CFE_UNDERLINE
Definition: richedit.h:408
#define CFE_SUBSCRIPT
Definition: richedit.h:412
#define ES_DISABLENOSCROLL
Definition: richedit.h:224
#define EM_EXSETSEL
Definition: richedit.h:88
#define CFM_ALL2
Definition: richedit.h:393
#define CFE_AUTOBACKCOLOR
Definition: richedit.h:425
struct _charformat2w CHARFORMAT2W
#define ENM_REQUESTRESIZE
Definition: richedit.h:477
#define EM_EXGETSEL
Definition: richedit.h:85
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
int winetest_debug
#define win_skip
Definition: test.h:164
#define memset(x, y, z)
Definition: compat.h:39
static FILE * client
Definition: client.c:41
HRESULT hr
Definition: shlfolder.c:183
& rect
Definition: startmenu.cpp:1413
DWORD scrollbars
Definition: txtsrv.c:116
CHARFORMAT2W char_format
Definition: txtsrv.c:115
ITextHost ITextHost_iface
Definition: txtsrv.c:111
RECT client_rect
Definition: txtsrv.c:114
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfPitchAndFamily
Definition: dimm.idl:71
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
BYTE bCharSet
Definition: richedit.h:311
DWORD dwMask
Definition: richedit.h:306
WCHAR szFaceName[LF_FACESIZE]
Definition: richedit.h:313
DWORD dwEffects
Definition: richedit.h:307
LONG yHeight
Definition: richedit.h:308
BYTE bPitchAndFamily
Definition: richedit.h:312
LONG yHeight
Definition: richedit.h:271
WCHAR szFaceName[LF_FACESIZE]
Definition: richedit.h:276
DWORD dwEffects
Definition: richedit.h:270
BYTE bCharSet
Definition: richedit.h:274
BYTE bPitchAndFamily
Definition: richedit.h:275
DWORD dwUser
Definition: richole.idl:67
CLSID clsid
Definition: richole.idl:60
DWORD dwFlags
Definition: richole.idl:66
LPSTORAGE pstg
Definition: richole.idl:62
LPOLEOBJECT poleobj
Definition: richole.idl:61
DWORD dvaspect
Definition: richole.idl:65
LPOLECLIENTSITE polesite
Definition: richole.idl:63
DWORD cbStruct
Definition: richole.idl:58
LONG cp
Definition: richole.idl:59
SIZEL sizel
Definition: richole.idl:64
Definition: inflate.c:139
Definition: txthost.c:37
Definition: parser.c:49
Definition: module.h:576
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
Definition: cproxy.c:248
Definition: api.c:544
IUnknown IUnknown_iface
Definition: api.c:545
IUnknown * inner_unk
Definition: api.c:547
LONG ref
Definition: api.c:546
@ TXTNS_FITTOCONTENT
Definition: textserv.h:176
#define TXTBIT_WORDWRAP
Definition: textserv.h:195
#define TXTBIT_CLIENTRECTCHANGE
Definition: textserv.h:205
#define TXTBIT_MULTILINE
Definition: textserv.h:186
enum _TXTBACKSTYLE TXTBACKSTYLE
#define TXTBIT_SCROLLBARCHANGE
Definition: textserv.h:201
#define TXTBIT_RICHTEXT
Definition: textserv.h:185
@ TXTVIEW_INACTIVE
Definition: textserv.h:182
@ TXTVIEW_ACTIVE
Definition: textserv.h:181
HRESULT(WINAPI * PCreateTextServices)(IUnknown *, ITextHost *, IUnknown **)
Definition: textserv.h:448
int32_t INT
Definition: typedefs.h:58
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:65
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:119
#define RECT
Definition: precomp.h:26
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
DWORD COLORREF
Definition: windef.h:300
HICON HCURSOR
Definition: windef.h:299
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_UNEXPECTED
Definition: winerror.h:2456
int WINAPI SetMapMode(_In_ HDC, _In_ int)
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define MM_TEXT
Definition: wingdi.h:873
#define FW_NORMAL
Definition: wingdi.h:373
static int init
Definition: wintirpc.c:33
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define MAKEWPARAM(l, h)
Definition: winuser.h:4111
#define SB_THUMBTRACK
Definition: winuser.h:573
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WM_VSCROLL
Definition: winuser.h:1772
#define EN_UPDATE
Definition: winuser.h:2057
#define SB_BOTTOM
Definition: winuser.h:577
#define EM_REPLACESEL
Definition: winuser.h:2035
#define DT_NOCLIP
Definition: winuser.h:536
#define DT_LEFT
Definition: winuser.h:534
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HDC WINAPI GetDC(_In_opt_ HWND)
#define SB_LINEDOWN
Definition: winuser.h:565
#define EM_SETSEL
Definition: winuser.h:2047
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define EN_VSCROLL
Definition: winuser.h:2058
#define DT_CALCRECT
Definition: winuser.h:526
#define DT_EDITCONTROL
Definition: winuser.h:528
BOOL WINAPI DestroyWindow(_In_ HWND)
#define EN_CHANGE
Definition: winuser.h:2051
#define SB_THUMBPOSITION
Definition: winuser.h:572
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193