ReactOS 0.4.16-dev-1946-g52006dd
txtsrv.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <objbase.h>
#include <richedit.h>
#include <tom.h>
#include <richole.h>
#include <initguid.h>
#include <imm.h>
#include <textserv.h>
#include <wine/test.h>
#include <oleauto.h>
#include <limits.h>
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for txtsrv.c:

Go to the source code of this file.

Classes

struct  ITextHostTestImpl
 
struct  THISCALL_TO_STDCALL_THUNK
 
struct  STDCALL_TO_THISCALL_THUNK
 
struct  unk_impl
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define DEFINE_EXPECT(func)    static UINT called_count_ ## func = 0
 
#define INCREASE_CALL_COUNTER(func)
 
#define CHECK_CALLED(func)
 
#define CHECK_NOT_CALLED(func)
 
#define CLEAR_COUNTER(func)    called_count_ ## func = 0
 
#define TXTSERV_VTABLE(This)   (This)->lpVtbl
 
#define ITextServices_TxSendMessage(This, a, b, c, d)   TXTSERV_VTABLE(This)->TxSendMessage(This,a,b,c,d)
 
#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)
 
#define ITextServices_TxGetHScroll(This, a, b, c, d, e)   TXTSERV_VTABLE(This)->TxGetHScroll(This,a,b,c,d,e)
 
#define ITextServices_TxGetVScroll(This, a, b, c, d, e)   TXTSERV_VTABLE(This)->TxGetVScroll(This,a,b,c,d,e)
 
#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)
 
#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)
 
#define ITextServices_OnTxInPlaceActivate(This, a)   TXTSERV_VTABLE(This)->OnTxInPlaceActivate(This,a)
 
#define ITextServices_OnTxInPlaceDeactivate(This)   TXTSERV_VTABLE(This)->OnTxInPlaceDeactivate(This)
 
#define ITextServices_OnTxUIActivate(This)   TXTSERV_VTABLE(This)->OnTxUIActivate(This)
 
#define ITextServices_OnTxUIDeactivate(This)   TXTSERV_VTABLE(This)->OnTxUIDeactivate(This)
 
#define ITextServices_TxGetText(This, a)   TXTSERV_VTABLE(This)->TxGetText(This,a)
 
#define ITextServices_TxSetText(This, a)   TXTSERV_VTABLE(This)->TxSetText(This,a)
 
#define ITextServices_TxGetCurTargetX(This, a)   TXTSERV_VTABLE(This)->TxGetCurTargetX(This,a)
 
#define ITextServices_TxGetBaseLinePos(This, a)   TXTSERV_VTABLE(This)->TxGetBaseLinePos(This,a)
 
#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)
 
#define ITextServices_TxGetDropTarget(This, a)   TXTSERV_VTABLE(This)->TxGetDropTarget(This,a)
 
#define ITextServices_OnTxPropertyBitsChange(This, a, b)   TXTSERV_VTABLE(This)->OnTxPropertyBitsChange(This,a,b)
 
#define ITextServices_TxGetCachedSize(This, a, b)   TXTSERV_VTABLE(This)->TxGetCachedSize(This,a,b)
 
#define TRACECALL   if(winetest_debug > 1) trace
 
#define CHECK_TXGETNATURALSIZE(res, width, height, hdc, rect, string)    _check_txgetnaturalsize(res, width, height, hdc, rect, string, __LINE__)
 

Typedefs

typedef struct ITextHostTestImpl ITextHostTestImpl
 

Functions

 DEFINE_EXPECT (ITextHostImpl_TxViewChange)
 
 DEFINE_EXPECT (ITextHostImpl_TxScrollWindowEx)
 
 DEFINE_EXPECT (ITextHostImpl_TxGetClientRect)
 
static ITextHostTestImplimpl_from_ITextHost (ITextHost *iface)
 
static HRESULT WINAPI ITextHostImpl_QueryInterface (ITextHost *iface, REFIID riid, LPVOID *ppvObject)
 
static ULONG WINAPI ITextHostImpl_AddRef (ITextHost *iface)
 
static ULONG WINAPI ITextHostImpl_Release (ITextHost *iface)
 
static HDC __thiscall ITextHostImpl_TxGetDC (ITextHost *iface)
 
static INT __thiscall ITextHostImpl_TxReleaseDC (ITextHost *iface, HDC hdc)
 
static BOOL __thiscall ITextHostImpl_TxShowScrollBar (ITextHost *iface, INT fnBar, BOOL fShow)
 
static BOOL __thiscall ITextHostImpl_TxEnableScrollBar (ITextHost *iface, INT fuSBFlags, INT fuArrowflags)
 
static BOOL __thiscall ITextHostImpl_TxSetScrollRange (ITextHost *iface, INT fnBar, LONG nMinPos, INT nMaxPos, BOOL fRedraw)
 
static BOOL __thiscall ITextHostImpl_TxSetScrollPos (ITextHost *iface, INT fnBar, INT nPos, BOOL fRedraw)
 
static void __thiscall ITextHostImpl_TxInvalidateRect (ITextHost *iface, LPCRECT prc, BOOL fMode)
 
static void __thiscall ITextHostImpl_TxViewChange (ITextHost *iface, BOOL fUpdate)
 
static BOOL __thiscall ITextHostImpl_TxCreateCaret (ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight)
 
static BOOL __thiscall ITextHostImpl_TxShowCaret (ITextHost *iface, BOOL fShow)
 
static BOOL __thiscall ITextHostImpl_TxSetCaretPos (ITextHost *iface, INT x, INT y)
 
static BOOL __thiscall ITextHostImpl_TxSetTimer (ITextHost *iface, UINT idTimer, UINT uTimeout)
 
static void __thiscall ITextHostImpl_TxKillTimer (ITextHost *iface, UINT idTimer)
 
static void __thiscall ITextHostImpl_TxScrollWindowEx (ITextHost *iface, INT dx, INT dy, LPCRECT lprcScroll, LPCRECT lprcClip, HRGN hRgnUpdate, LPRECT lprcUpdate, UINT fuScroll)
 
static void __thiscall ITextHostImpl_TxSetCapture (ITextHost *iface, BOOL fCapture)
 
static void __thiscall ITextHostImpl_TxSetFocus (ITextHost *iface)
 
static void __thiscall ITextHostImpl_TxSetCursor (ITextHost *iface, HCURSOR hcur, BOOL fText)
 
static BOOL __thiscall ITextHostImpl_TxScreenToClient (ITextHost *iface, LPPOINT lppt)
 
static BOOL __thiscall ITextHostImpl_TxClientToScreen (ITextHost *iface, LPPOINT lppt)
 
static HRESULT __thiscall ITextHostImpl_TxActivate (ITextHost *iface, LONG *plOldState)
 
static HRESULT __thiscall ITextHostImpl_TxDeactivate (ITextHost *iface, LONG lNewState)
 
static HRESULT __thiscall ITextHostImpl_TxGetClientRect (ITextHost *iface, LPRECT prc)
 
static HRESULT __thiscall ITextHostImpl_TxGetViewInset (ITextHost *iface, LPRECT prc)
 
static HRESULT __thiscall ITextHostImpl_TxGetCharFormat (ITextHost *iface, const CHARFORMATW **ppCF)
 
static HRESULT __thiscall ITextHostImpl_TxGetParaFormat (ITextHost *iface, const PARAFORMAT **ppPF)
 
static COLORREF __thiscall ITextHostImpl_TxGetSysColor (ITextHost *iface, int nIndex)
 
static HRESULT __thiscall ITextHostImpl_TxGetBackStyle (ITextHost *iface, TXTBACKSTYLE *pStyle)
 
static HRESULT __thiscall ITextHostImpl_TxGetMaxLength (ITextHost *iface, DWORD *pLength)
 
static HRESULT __thiscall ITextHostImpl_TxGetScrollBars (ITextHost *iface, DWORD *scrollbars)
 
static HRESULT __thiscall ITextHostImpl_TxGetPasswordChar (ITextHost *iface, WCHAR *pch)
 
static HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos (ITextHost *iface, LONG *pch)
 
static HRESULT __thiscall ITextHostImpl_TxGetExtent (ITextHost *iface, LPSIZEL lpExtent)
 
static HRESULT __thiscall ITextHostImpl_OnTxCharFormatChange (ITextHost *iface, const CHARFORMATW *pcf)
 
static HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange (ITextHost *iface, const PARAFORMAT *ppf)
 
static HRESULT __thiscall ITextHostImpl_TxGetPropertyBits (ITextHost *iface, DWORD dwMask, DWORD *pdwBits)
 
static HRESULT __thiscall ITextHostImpl_TxNotify (ITextHost *iface, DWORD code, void *data)
 
static HIMC __thiscall ITextHostImpl_TxImmGetContext (ITextHost *iface)
 
static void __thiscall ITextHostImpl_TxImmReleaseContext (ITextHost *iface, HIMC himc)
 
static HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth (ITextHost *iface, LONG *lSelBarWidth)
 
static void setup_thiscall_wrappers (void)
 
static void hf_to_cf (HFONT hf, CHARFORMAT2W *cf)
 
static BOOL init_texthost (ITextServices **txtserv, ITextHost **ret)
 
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)
 
static void test_TxGetText (void)
 
static void test_TxSetText (void)
 
static void _check_txgetnaturalsize (HRESULT res, LONG width, LONG height, HDC hdc, RECT rect, LPCWSTR string, int line)
 
static void test_TxGetNaturalSize (void)
 
static void test_TxDraw (void)
 
 DEFINE_GUID (expected_iid_itextservices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5)
 
 DEFINE_GUID (expected_iid_itexthost, 0x13e670f4, 0x1a5a, 0x11cf, 0xab, 0xeb, 0x00, 0xaa, 0x00, 0xb6, 0x5e, 0xa1)
 
 DEFINE_GUID (expected_iid_itexthost2, 0x13e670f5, 0x1a5a, 0x11cf, 0xab, 0xeb, 0x00, 0xaa, 0x00, 0xb6, 0x5e, 0xa1)
 
static void test_IIDs (void)
 
static struct unk_implimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI unk_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI unk_AddRef (IUnknown *iface)
 
static ULONG WINAPI unk_Release (IUnknown *iface)
 
static void test_COM (void)
 
static ULONG get_refcount (IUnknown *iface)
 
static void test_QueryInterface (void)
 
static void test_default_format (void)
 
static void test_TxGetScroll (void)
 
static void test_notifications (void)
 
static void test_set_selection_message (void)
 
static void test_scrollcaret (void)
 
static void test_inplace_active (BOOL active)
 
 START_TEST (txtsrv)
 

Variables

static HMODULE hmoduleRichEdit
 
static IIDpIID_ITextServices
 
static IIDpIID_ITextHost
 
static IIDpIID_ITextHost2
 
static PCreateTextServices pCreateTextServices
 
static const WCHAR lorem []
 
static int en_vscroll_sent
 
static int en_update_sent
 
static int en_change_sent
 
static int en_selchange_sent
 
static ITextHostVtbl itextHostVtbl
 
static voidwrapperCodeMem = NULL
 
static const IUnknownVtbl unk_vtbl
 

Macro Definition Documentation

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_count_ ## func, "expected " #func "\n"); \
}while(0)
GLenum func
Definition: glext.h:6028

Definition at line 49 of file txtsrv.c.

◆ CHECK_NOT_CALLED

#define CHECK_NOT_CALLED (   func)
Value:
do { \
ok(!called_count_ ## func, "unexpected " #func "\n"); \
}while(0)

Definition at line 54 of file txtsrv.c.

◆ CHECK_TXGETNATURALSIZE

#define CHECK_TXGETNATURALSIZE (   res,
  width,
  height,
  hdc,
  rect,
  string 
)     _check_txgetnaturalsize(res, width, height, hdc, rect, string, __LINE__)

Definition at line 788 of file txtsrv.c.

◆ CLEAR_COUNTER

#define CLEAR_COUNTER (   func)     called_count_ ## func = 0

Definition at line 59 of file txtsrv.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file txtsrv.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 24 of file txtsrv.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)     static UINT called_count_ ## func = 0

Definition at line 41 of file txtsrv.c.

◆ INCREASE_CALL_COUNTER

#define INCREASE_CALL_COUNTER (   func)
Value:
do { \
called_count_ ## func++; \
}while(0)

Definition at line 44 of file txtsrv.c.

◆ ITextServices_OnTxInPlaceActivate

#define ITextServices_OnTxInPlaceActivate (   This,
  a 
)    TXTSERV_VTABLE(This)->OnTxInPlaceActivate(This,a)

Definition at line 85 of file txtsrv.c.

◆ ITextServices_OnTxInPlaceDeactivate

#define ITextServices_OnTxInPlaceDeactivate (   This)    TXTSERV_VTABLE(This)->OnTxInPlaceDeactivate(This)

Definition at line 86 of file txtsrv.c.

◆ ITextServices_OnTxPropertyBitsChange

#define ITextServices_OnTxPropertyBitsChange (   This,
  a,
  b 
)    TXTSERV_VTABLE(This)->OnTxPropertyBitsChange(This,a,b)

Definition at line 95 of file txtsrv.c.

◆ ITextServices_OnTxSetCursor

#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)

Definition at line 83 of file txtsrv.c.

◆ ITextServices_OnTxUIActivate

#define ITextServices_OnTxUIActivate (   This)    TXTSERV_VTABLE(This)->OnTxUIActivate(This)

Definition at line 87 of file txtsrv.c.

◆ ITextServices_OnTxUIDeactivate

#define ITextServices_OnTxUIDeactivate (   This)    TXTSERV_VTABLE(This)->OnTxUIDeactivate(This)

Definition at line 88 of file txtsrv.c.

◆ ITextServices_TxDraw

#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)

Definition at line 80 of file txtsrv.c.

◆ ITextServices_TxGetBaseLinePos

#define ITextServices_TxGetBaseLinePos (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetBaseLinePos(This,a)

Definition at line 92 of file txtsrv.c.

◆ ITextServices_TxGetCachedSize

#define ITextServices_TxGetCachedSize (   This,
  a,
  b 
)    TXTSERV_VTABLE(This)->TxGetCachedSize(This,a,b)

Definition at line 96 of file txtsrv.c.

◆ ITextServices_TxGetCurTargetX

#define ITextServices_TxGetCurTargetX (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetCurTargetX(This,a)

Definition at line 91 of file txtsrv.c.

◆ ITextServices_TxGetDropTarget

#define ITextServices_TxGetDropTarget (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetDropTarget(This,a)

Definition at line 94 of file txtsrv.c.

◆ ITextServices_TxGetHScroll

#define ITextServices_TxGetHScroll (   This,
  a,
  b,
  c,
  d,
  e 
)    TXTSERV_VTABLE(This)->TxGetHScroll(This,a,b,c,d,e)

Definition at line 81 of file txtsrv.c.

◆ ITextServices_TxGetNaturalSize

#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)

Definition at line 93 of file txtsrv.c.

◆ ITextServices_TxGetText

#define ITextServices_TxGetText (   This,
  a 
)    TXTSERV_VTABLE(This)->TxGetText(This,a)

Definition at line 89 of file txtsrv.c.

◆ ITextServices_TxGetVScroll

#define ITextServices_TxGetVScroll (   This,
  a,
  b,
  c,
  d,
  e 
)    TXTSERV_VTABLE(This)->TxGetVScroll(This,a,b,c,d,e)

Definition at line 82 of file txtsrv.c.

◆ ITextServices_TxQueryHitPoint

#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)

Definition at line 84 of file txtsrv.c.

◆ ITextServices_TxSendMessage

#define ITextServices_TxSendMessage (   This,
  a,
  b,
  c,
  d 
)    TXTSERV_VTABLE(This)->TxSendMessage(This,a,b,c,d)

Definition at line 79 of file txtsrv.c.

◆ ITextServices_TxSetText

#define ITextServices_TxSetText (   This,
  a 
)    TXTSERV_VTABLE(This)->TxSetText(This,a)

Definition at line 90 of file txtsrv.c.

◆ TRACECALL

#define TRACECALL   if(winetest_debug > 1) trace

Definition at line 100 of file txtsrv.c.

◆ TXTSERV_VTABLE

#define TXTSERV_VTABLE (   This)    (This)->lpVtbl

Definition at line 76 of file txtsrv.c.

Typedef Documentation

◆ ITextHostTestImpl

Function Documentation

◆ _check_txgetnaturalsize()

static void _check_txgetnaturalsize ( HRESULT  res,
LONG  width,
LONG  height,
HDC  hdc,
RECT  rect,
LPCWSTR  string,
int  line 
)
static

Definition at line 790 of file txtsrv.c.

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}
#define ok_(x1, x2)
Definition: atltest.h:61
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint res
Definition: glext.h:9613
#define S_OK
Definition: intsafe.h:52
#define todo_wine
Definition: minitest.h:80
HDC hdc
Definition: main.c:9
static RECT expected_rect
Definition: win.c:5821
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
long LONG
Definition: pedump.c:60
& rect
Definition: startmenu.cpp:1413
Definition: parser.c:49
Definition: windef.h:99
LONG right
Definition: windef.h:102
LONG bottom
Definition: windef.h:103
LONG top
Definition: windef.h:101
LONG left
Definition: windef.h:100
#define DT_NOCLIP
Definition: winuser.h:536
#define DT_LEFT
Definition: winuser.h:534
#define DT_CALCRECT
Definition: winuser.h:526
#define DT_EDITCONTROL
Definition: winuser.h:528

◆ DEFINE_EXPECT() [1/3]

DEFINE_EXPECT ( ITextHostImpl_TxGetClientRect  )

◆ DEFINE_EXPECT() [2/3]

DEFINE_EXPECT ( ITextHostImpl_TxScrollWindowEx  )

◆ DEFINE_EXPECT() [3/3]

DEFINE_EXPECT ( ITextHostImpl_TxViewChange  )

◆ DEFINE_GUID() [1/3]

DEFINE_GUID ( expected_iid_itexthost  ,
0x13e670f4  ,
0x1a5a  ,
0x11cf  ,
0xab  ,
0xeb  ,
0x00  ,
0xaa  ,
0x00  ,
0xb6  ,
0x5e  ,
0xa1   
)

◆ DEFINE_GUID() [2/3]

DEFINE_GUID ( expected_iid_itexthost2  ,
0x13e670f5  ,
0x1a5a  ,
0x11cf  ,
0xab  ,
0xeb  ,
0x00  ,
0xaa  ,
0x00  ,
0xb6  ,
0x5e  ,
0xa1   
)

◆ DEFINE_GUID() [3/3]

DEFINE_GUID ( expected_iid_itextservices  ,
0x8d33f740  ,
0xcf58  ,
0x11ce  ,
0xa8  ,
0x9d  ,
0x00  ,
0xaa  ,
0x00  ,
0x6c  ,
0xad  ,
0xc5   
)

◆ fill_reobject_struct()

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 
)
static

Definition at line 692 of file txtsrv.c.

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}
void user(int argc, const char *argv[])
Definition: cmds.c:1350
GLbitfield flags
Definition: glext.h:7161
POINT cp
Definition: magnifier.c:59
#define CLSID_NULL
Definition: guiddef.h:99
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
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

Referenced by test_TxGetText().

◆ get_refcount()

static ULONG get_refcount ( IUnknown iface)
static

Definition at line 1007 of file txtsrv.c.

1008{
1009 IUnknown_AddRef(iface);
1010 return IUnknown_Release(iface);
1011}

Referenced by test_QueryInterface().

◆ hf_to_cf()

static void hf_to_cf ( HFONT  hf,
CHARFORMAT2W cf 
)
static

Definition at line 624 of file txtsrv.c.

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}
#define NULL
Definition: types.h:112
#define lstrcpyW
Definition: compat.h:749
#define abs(i)
Definition: fconv.c:206
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
#define CFE_BOLD
Definition: richedit.h:406
#define CFE_ITALIC
Definition: richedit.h:407
#define CFE_UNDERLINE
Definition: richedit.h:408
#define CFE_SUBSCRIPT
Definition: richedit.h:412
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
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 FW_NORMAL
Definition: wingdi.h:373
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by init_texthost(), and test_TxGetNaturalSize().

◆ impl_from_ITextHost()

static ITextHostTestImpl * impl_from_ITextHost ( ITextHost *  iface)
inlinestatic

Definition at line 119 of file txtsrv.c.

120{
121 return CONTAINING_RECORD(iface, ITextHostTestImpl, ITextHost_iface);
122}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by ITextHostImpl_AddRef(), ITextHostImpl_OnTxCharFormatChange(), ITextHostImpl_OnTxParaFormatChange(), ITextHostImpl_QueryInterface(), ITextHostImpl_Release(), ITextHostImpl_TxActivate(), ITextHostImpl_TxClientToScreen(), ITextHostImpl_TxCreateCaret(), ITextHostImpl_TxDeactivate(), ITextHostImpl_TxEnableScrollBar(), ITextHostImpl_TxGetAcceleratorPos(), ITextHostImpl_TxGetBackStyle(), ITextHostImpl_TxGetCharFormat(), ITextHostImpl_TxGetClientRect(), ITextHostImpl_TxGetDC(), ITextHostImpl_TxGetExtent(), ITextHostImpl_TxGetMaxLength(), ITextHostImpl_TxGetParaFormat(), ITextHostImpl_TxGetPasswordChar(), ITextHostImpl_TxGetPropertyBits(), ITextHostImpl_TxGetScrollBars(), ITextHostImpl_TxGetSelectionBarWidth(), ITextHostImpl_TxGetSysColor(), ITextHostImpl_TxGetViewInset(), ITextHostImpl_TxImmGetContext(), ITextHostImpl_TxImmReleaseContext(), ITextHostImpl_TxInvalidateRect(), ITextHostImpl_TxKillTimer(), ITextHostImpl_TxNotify(), ITextHostImpl_TxReleaseDC(), ITextHostImpl_TxScreenToClient(), ITextHostImpl_TxScrollWindowEx(), ITextHostImpl_TxSetCapture(), ITextHostImpl_TxSetCaretPos(), ITextHostImpl_TxSetCursor(), ITextHostImpl_TxSetFocus(), ITextHostImpl_TxSetScrollPos(), ITextHostImpl_TxSetScrollRange(), ITextHostImpl_TxSetTimer(), ITextHostImpl_TxShowCaret(), ITextHostImpl_TxShowScrollBar(), ITextHostImpl_TxViewChange(), test_inplace_active(), test_notifications(), test_TxDraw(), and test_TxGetScroll().

◆ impl_from_IUnknown()

static struct unk_impl * impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 950 of file txtsrv.c.

951{
952 return CONTAINING_RECORD(iface, struct unk_impl, IUnknown_iface);
953}
Definition: api.c:544

◆ init_texthost()

static BOOL init_texthost ( ITextServices **  txtserv,
ITextHost **  ret 
)
static

Definition at line 643 of file txtsrv.c.

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}
#define ok(value,...)
Definition: atltest.h:57
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
return ret
Definition: mutex.c:146
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
#define win_skip
Definition: minitest.h:67
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static IID * pIID_ITextServices
Definition: txtsrv.c:63
static void hf_to_cf(HFONT hf, CHARFORMAT2W *cf)
Definition: txtsrv.c:624
static PCreateTextServices pCreateTextServices
Definition: txtsrv.c:66
static ITextHostVtbl itextHostVtbl
Definition: txtsrv.c:485
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define CFM_ALL2
Definition: richedit.h:393
#define memset(x, y, z)
Definition: compat.h:39
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
DWORD dwMask
Definition: richedit.h:306
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
static int init
Definition: wintirpc.c:33
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)

Referenced by START_TEST(), test_default_format(), test_inplace_active(), test_notifications(), test_QueryInterface(), test_scrollcaret(), test_set_selection_message(), test_TxDraw(), test_TxGetNaturalSize(), test_TxGetScroll(), test_TxGetText(), and test_TxSetText().

◆ ITextHostImpl_AddRef()

static ULONG WINAPI ITextHostImpl_AddRef ( ITextHost *  iface)
static

Definition at line 144 of file txtsrv.c.

145{
147 ULONG refCount = InterlockedIncrement(&This->refCount);
148 return refCount;
149}
#define InterlockedIncrement
Definition: armddk.h:53
static ITextHostTestImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txtsrv.c:119
uint32_t ULONG
Definition: typedefs.h:59

◆ ITextHostImpl_OnTxCharFormatChange()

static HRESULT __thiscall ITextHostImpl_OnTxCharFormatChange ( ITextHost *  iface,
const CHARFORMATW pcf 
)
static

Definition at line 404 of file txtsrv.c.

405{
407 TRACECALL("Call to OnTxCharFormatChange(%p, pcf=%p)\n", This, pcf);
408 return E_NOTIMPL;
409}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACECALL
Definition: txtsrv.c:100

◆ ITextHostImpl_OnTxParaFormatChange()

static HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange ( ITextHost *  iface,
const PARAFORMAT ppf 
)
static

Definition at line 411 of file txtsrv.c.

412{
414 TRACECALL("Call to OnTxParaFormatChange(%p, ppf=%p)\n", This, ppf);
415 return E_NOTIMPL;
416}

◆ ITextHostImpl_QueryInterface()

static HRESULT WINAPI ITextHostImpl_QueryInterface ( ITextHost *  iface,
REFIID  riid,
LPVOID ppvObject 
)
static

Definition at line 129 of file txtsrv.c.

132{
134
136 *ppvObject = &This->ITextHost_iface;
137 ITextHost_AddRef((ITextHost *)*ppvObject);
138 return S_OK;
139 }
140
141 return E_NOINTERFACE;
142}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
static IID * pIID_ITextHost
Definition: txtsrv.c:64
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ ITextHostImpl_Release()

static ULONG WINAPI ITextHostImpl_Release ( ITextHost *  iface)
static

Definition at line 151 of file txtsrv.c.

152{
154 ULONG refCount = InterlockedDecrement(&This->refCount);
155
156 if (!refCount)
157 {
159 return 0;
160 } else {
161 return refCount;
162 }
163}
#define InterlockedDecrement
Definition: armddk.h:52

◆ ITextHostImpl_TxActivate()

static HRESULT __thiscall ITextHostImpl_TxActivate ( ITextHost *  iface,
LONG plOldState 
)
static

Definition at line 309 of file txtsrv.c.

310{
312 TRACECALL("Call to TxActivate(%p, plOldState=%p)\n", This, plOldState);
313 return E_NOTIMPL;
314}

◆ ITextHostImpl_TxClientToScreen()

static BOOL __thiscall ITextHostImpl_TxClientToScreen ( ITextHost *  iface,
LPPOINT  lppt 
)
static

Definition at line 302 of file txtsrv.c.

303{
305 TRACECALL("Call to TxClientToScreen(%p, lppt=%p)\n", This, lppt);
306 return FALSE;
307}

◆ ITextHostImpl_TxCreateCaret()

static BOOL __thiscall ITextHostImpl_TxCreateCaret ( ITextHost *  iface,
HBITMAP  hbmp,
INT  xWidth,
INT  yHeight 
)
static

Definition at line 229 of file txtsrv.c.

230{
232 TRACECALL("Call to TxCreateCaret(%p, nbmp=%p, xWidth=%d, yHeight=%d)\n",
233 This, hbmp, xWidth, yHeight);
234 return FALSE;
235}
HBITMAP hbmp

◆ ITextHostImpl_TxDeactivate()

static HRESULT __thiscall ITextHostImpl_TxDeactivate ( ITextHost *  iface,
LONG  lNewState 
)
static

Definition at line 316 of file txtsrv.c.

317{
319 TRACECALL("Call to TxDeactivate(%p, lNewState=%ld)\n", This, lNewState);
320 return E_NOTIMPL;
321}

◆ ITextHostImpl_TxEnableScrollBar()

static BOOL __thiscall ITextHostImpl_TxEnableScrollBar ( ITextHost *  iface,
INT  fuSBFlags,
INT  fuArrowflags 
)
static

Definition at line 189 of file txtsrv.c.

190{
192 TRACECALL("Call to TxEnableScrollBar(%p, fuSBFlags=%d, fuArrowflags=%d)\n",
193 This, fuSBFlags, fuArrowflags);
194 return FALSE;
195}

◆ ITextHostImpl_TxGetAcceleratorPos()

static HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos ( ITextHost *  iface,
LONG pch 
)
static

Definition at line 390 of file txtsrv.c.

391{
393 TRACECALL("Call to TxGetAcceleratorPos(%p, pch=%p)\n", This, pch);
394 return E_NOTIMPL;
395}
#define pch(ap)
Definition: match.c:418

◆ ITextHostImpl_TxGetBackStyle()

static HRESULT __thiscall ITextHostImpl_TxGetBackStyle ( ITextHost *  iface,
TXTBACKSTYLE pStyle 
)
static

Definition at line 361 of file txtsrv.c.

362{
364 TRACECALL("Call to TxGetBackStyle(%p, pStyle=%p)\n", This, pStyle);
365 return E_NOTIMPL;
366}

◆ ITextHostImpl_TxGetCharFormat()

static HRESULT __thiscall ITextHostImpl_TxGetCharFormat ( ITextHost *  iface,
const CHARFORMATW **  ppCF 
)
static

Definition at line 339 of file txtsrv.c.

340{
342 TRACECALL("Call to TxGetCharFormat(%p, ppCF=%p)\n", This, ppCF);
343 *ppCF = (CHARFORMATW *)&This->char_format;
344 return S_OK;
345}

Referenced by test_default_format().

◆ ITextHostImpl_TxGetClientRect()

static HRESULT __thiscall ITextHostImpl_TxGetClientRect ( ITextHost *  iface,
LPRECT  prc 
)
static

Definition at line 323 of file txtsrv.c.

324{
326 TRACECALL("Call to TxGetClientRect(%p, prc=%p)\n", This, prc);
328 *prc = This->client_rect;
329 return S_OK;
330}
#define INCREASE_CALL_COUNTER(func)
Definition: txtsrv.c:44
static HRESULT __thiscall ITextHostImpl_TxGetClientRect(ITextHost *iface, LPRECT prc)
Definition: txtsrv.c:323
_Out_ LPRECT prc
Definition: ntgdi.h:1658

Referenced by ITextHostImpl_TxGetClientRect(), and test_inplace_active().

◆ ITextHostImpl_TxGetDC()

static HDC __thiscall ITextHostImpl_TxGetDC ( ITextHost *  iface)
static

Definition at line 165 of file txtsrv.c.

166{
168 TRACECALL("Call to TxGetDC(%p)\n", This);
169 if (This->window) return GetDC( This->window );
170 return NULL;
171}

◆ ITextHostImpl_TxGetExtent()

static HRESULT __thiscall ITextHostImpl_TxGetExtent ( ITextHost *  iface,
LPSIZEL  lpExtent 
)
static

Definition at line 397 of file txtsrv.c.

398{
400 TRACECALL("Call to TxGetExtent(%p, lpExtent=%p)\n", This, lpExtent);
401 return E_NOTIMPL;
402}

◆ ITextHostImpl_TxGetMaxLength()

static HRESULT __thiscall ITextHostImpl_TxGetMaxLength ( ITextHost *  iface,
DWORD pLength 
)
static

Definition at line 368 of file txtsrv.c.

369{
371 TRACECALL("Call to TxGetMaxLength(%p, pLength=%p)\n", This, pLength);
372 return E_NOTIMPL;
373}

◆ ITextHostImpl_TxGetParaFormat()

static HRESULT __thiscall ITextHostImpl_TxGetParaFormat ( ITextHost *  iface,
const PARAFORMAT **  ppPF 
)
static

Definition at line 347 of file txtsrv.c.

348{
350 TRACECALL("Call to TxGetParaFormat(%p, ppPF=%p)\n", This, ppPF);
351 return E_NOTIMPL;
352}

◆ ITextHostImpl_TxGetPasswordChar()

static HRESULT __thiscall ITextHostImpl_TxGetPasswordChar ( ITextHost *  iface,
WCHAR pch 
)
static

Definition at line 383 of file txtsrv.c.

384{
386 TRACECALL("Call to TxGetPasswordChar(%p, pch=%p)\n", This, pch);
387 return E_NOTIMPL;
388}

◆ ITextHostImpl_TxGetPropertyBits()

static HRESULT __thiscall ITextHostImpl_TxGetPropertyBits ( ITextHost *  iface,
DWORD  dwMask,
DWORD pdwBits 
)
static

Definition at line 420 of file txtsrv.c.

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}

◆ ITextHostImpl_TxGetScrollBars()

static HRESULT __thiscall ITextHostImpl_TxGetScrollBars ( ITextHost *  iface,
DWORD scrollbars 
)
static

Definition at line 375 of file txtsrv.c.

376{
378 TRACECALL("Call to TxGetScrollBars(%p, scrollbars=%p)\n", This, scrollbars);
379 *scrollbars = This->scrollbars;
380 return S_OK;
381}

◆ ITextHostImpl_TxGetSelectionBarWidth()

static HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth ( ITextHost *  iface,
LONG lSelBarWidth 
)
static

Definition at line 476 of file txtsrv.c.

477{
479 TRACECALL("Call to TxGetSelectionBarWidth(%p, lSelBarWidth=%p)\n",
480 This, lSelBarWidth);
481 *lSelBarWidth = 0;
482 return E_NOTIMPL;
483}

◆ ITextHostImpl_TxGetSysColor()

static COLORREF __thiscall ITextHostImpl_TxGetSysColor ( ITextHost *  iface,
int  nIndex 
)
static

Definition at line 354 of file txtsrv.c.

355{
357 TRACECALL("Call to TxGetSysColor(%p, nIndex=%d)\n", This, nIndex);
358 return E_NOTIMPL;
359}

◆ ITextHostImpl_TxGetViewInset()

static HRESULT __thiscall ITextHostImpl_TxGetViewInset ( ITextHost *  iface,
LPRECT  prc 
)
static

Definition at line 332 of file txtsrv.c.

333{
335 TRACECALL("Call to TxGetViewInset(%p, prc=%p)\n", This, prc);
336 return E_NOTIMPL;
337}

◆ ITextHostImpl_TxImmGetContext()

static HIMC __thiscall ITextHostImpl_TxImmGetContext ( ITextHost *  iface)
static

Definition at line 460 of file txtsrv.c.

461{
463 TRACECALL("Call to TxImmGetContext(%p)\n", This);
464 return 0;
465}

◆ ITextHostImpl_TxImmReleaseContext()

static void __thiscall ITextHostImpl_TxImmReleaseContext ( ITextHost *  iface,
HIMC  himc 
)
static

Definition at line 467 of file txtsrv.c.

468{
470 TRACECALL("Call to TxImmReleaseContext(%p, himc=%p)\n", This, himc);
471}

◆ ITextHostImpl_TxInvalidateRect()

static void __thiscall ITextHostImpl_TxInvalidateRect ( ITextHost *  iface,
LPCRECT  prc,
BOOL  fMode 
)
static

Definition at line 214 of file txtsrv.c.

215{
217 TRACECALL("Call to TxInvalidateRect(%p, prc=%p, fMode=%d)\n",
218 This, prc, fMode);
219}

◆ ITextHostImpl_TxKillTimer()

static void __thiscall ITextHostImpl_TxKillTimer ( ITextHost *  iface,
UINT  idTimer 
)
static

Definition at line 260 of file txtsrv.c.

261{
263 TRACECALL("Call to TxKillTimer(%p, idTimer=%u)\n", This, idTimer);
264}

◆ ITextHostImpl_TxNotify()

static HRESULT __thiscall ITextHostImpl_TxNotify ( ITextHost *  iface,
DWORD  code,
void data 
)
static

Definition at line 433 of file txtsrv.c.

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}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static int en_selchange_sent
Definition: txtsrv.c:432
static int en_change_sent
Definition: txtsrv.c:431
static int en_update_sent
Definition: txtsrv.c:430
static int en_vscroll_sent
Definition: txtsrv.c:429
#define EN_SELCHANGE
Definition: richedit.h:193
Definition: inflate.c:139
#define EN_UPDATE
Definition: winuser.h:2057
#define EN_VSCROLL
Definition: winuser.h:2058
#define EN_CHANGE
Definition: winuser.h:2051

◆ ITextHostImpl_TxReleaseDC()

static INT __thiscall ITextHostImpl_TxReleaseDC ( ITextHost *  iface,
HDC  hdc 
)
static

Definition at line 173 of file txtsrv.c.

174{
176 TRACECALL("Call to TxReleaseDC(%p)\n", This);
177 if (This->window) return ReleaseDC( This->window, hdc );
178 return 0;
179}
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)

◆ ITextHostImpl_TxScreenToClient()

static BOOL __thiscall ITextHostImpl_TxScreenToClient ( ITextHost *  iface,
LPPOINT  lppt 
)
static

Definition at line 295 of file txtsrv.c.

296{
298 TRACECALL("Call to TxScreenToClient(%p, lppt=%p)\n", This, lppt);
299 return FALSE;
300}

◆ ITextHostImpl_TxScrollWindowEx()

static void __thiscall ITextHostImpl_TxScrollWindowEx ( ITextHost *  iface,
INT  dx,
INT  dy,
LPCRECT  lprcScroll,
LPCRECT  lprcClip,
HRGN  hRgnUpdate,
LPRECT  lprcUpdate,
UINT  fuScroll 
)
static

Definition at line 266 of file txtsrv.c.

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}
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
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

Referenced by ITextHostImpl_TxScrollWindowEx(), and test_inplace_active().

◆ ITextHostImpl_TxSetCapture()

static void __thiscall ITextHostImpl_TxSetCapture ( ITextHost *  iface,
BOOL  fCapture 
)
static

Definition at line 276 of file txtsrv.c.

277{
279 TRACECALL("Call to TxSetCapture(%p, fCapture=%d)\n", This, fCapture);
280}

◆ ITextHostImpl_TxSetCaretPos()

static BOOL __thiscall ITextHostImpl_TxSetCaretPos ( ITextHost *  iface,
INT  x,
INT  y 
)
static

Definition at line 245 of file txtsrv.c.

246{
248 TRACECALL("Call to TxSetCaretPos(%p, x=%d, y=%d)\n", This, x, y);
249 return FALSE;
250}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ ITextHostImpl_TxSetCursor()

static void __thiscall ITextHostImpl_TxSetCursor ( ITextHost *  iface,
HCURSOR  hcur,
BOOL  fText 
)
static

Definition at line 288 of file txtsrv.c.

289{
291 TRACECALL("Call to TxSetCursor(%p, hcur=%p, fText=%d)\n",
292 This, hcur, fText);
293}

◆ ITextHostImpl_TxSetFocus()

static void __thiscall ITextHostImpl_TxSetFocus ( ITextHost *  iface)
static

Definition at line 282 of file txtsrv.c.

283{
285 TRACECALL("Call to TxSetFocus(%p)\n", This);
286}

◆ ITextHostImpl_TxSetScrollPos()

static BOOL __thiscall ITextHostImpl_TxSetScrollPos ( ITextHost *  iface,
INT  fnBar,
INT  nPos,
BOOL  fRedraw 
)
static

Definition at line 206 of file txtsrv.c.

207{
209 TRACECALL("Call to TxSetScrollPos(%p, fnBar=%d, nPos=%d, fRedraw=%d)\n",
210 This, fnBar, nPos, fRedraw);
211 return FALSE;
212}

◆ ITextHostImpl_TxSetScrollRange()

static BOOL __thiscall ITextHostImpl_TxSetScrollRange ( ITextHost *  iface,
INT  fnBar,
LONG  nMinPos,
INT  nMaxPos,
BOOL  fRedraw 
)
static

Definition at line 197 of file txtsrv.c.

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}

◆ ITextHostImpl_TxSetTimer()

static BOOL __thiscall ITextHostImpl_TxSetTimer ( ITextHost *  iface,
UINT  idTimer,
UINT  uTimeout 
)
static

Definition at line 252 of file txtsrv.c.

253{
255 TRACECALL("Call to TxSetTimer(%p, idTimer=%u, uTimeout=%u)\n",
256 This, idTimer, uTimeout);
257 return FALSE;
258}

◆ ITextHostImpl_TxShowCaret()

static BOOL __thiscall ITextHostImpl_TxShowCaret ( ITextHost *  iface,
BOOL  fShow 
)
static

Definition at line 237 of file txtsrv.c.

238{
240 TRACECALL("Call to TxShowCaret(%p, fShow=%d)\n",
241 This, fShow);
242 return FALSE;
243}

◆ ITextHostImpl_TxShowScrollBar()

static BOOL __thiscall ITextHostImpl_TxShowScrollBar ( ITextHost *  iface,
INT  fnBar,
BOOL  fShow 
)
static

Definition at line 181 of file txtsrv.c.

182{
184 TRACECALL("Call to TxShowScrollBar(%p, fnBar=%d, fShow=%d)\n",
185 This, fnBar, fShow);
186 return FALSE;
187}

◆ ITextHostImpl_TxViewChange()

static void __thiscall ITextHostImpl_TxViewChange ( ITextHost *  iface,
BOOL  fUpdate 
)
static

Definition at line 221 of file txtsrv.c.

222{
224 TRACECALL("Call to TxViewChange(%p, fUpdate=%d)\n",
225 This, fUpdate);
227}
static void __thiscall ITextHostImpl_TxViewChange(ITextHost *iface, BOOL fUpdate)
Definition: txtsrv.c:221

Referenced by ITextHostImpl_TxViewChange(), and test_set_selection_message().

◆ setup_thiscall_wrappers()

static void setup_thiscall_wrappers ( void  )
static

Definition at line 556 of file txtsrv.c.

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)
570 thunk = wrapperCodeMem;
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. */
604 thunk2 = (STDCALL_TO_THISCALL_THUNK *)thunk;
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}
static void * wrapperCodeMem
Definition: txtsrv.c:530
#define MEM_COMMIT
Definition: nt_native.h:1316
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1311
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:65

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( txtsrv  )

Definition at line 1457 of file txtsrv.c.

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}
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static void test_TxGetNaturalSize(void)
Definition: txtsrv.c:805
static void test_notifications(void)
Definition: txtsrv.c:1226
static void test_inplace_active(BOOL active)
Definition: txtsrv.c:1403
static HMODULE hmoduleRichEdit
Definition: txtsrv.c:62
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
Definition: txtsrv.c:643
static void test_TxSetText(void)
Definition: txtsrv.c:749
static void test_set_selection_message(void)
Definition: txtsrv.c:1282
static void setup_thiscall_wrappers(void)
Definition: txtsrv.c:556
static void test_QueryInterface(void)
Definition: txtsrv.c:1013
static void test_TxGetText(void)
Definition: txtsrv.c:709
static void test_TxDraw(void)
Definition: txtsrv.c:854
static void test_TxGetScroll(void)
Definition: txtsrv.c:1149
static void test_scrollcaret(void)
Definition: txtsrv.c:1386
static void test_default_format(void)
Definition: txtsrv.c:1119
static IID * pIID_ITextHost2
Definition: txtsrv.c:65
static void test_IIDs(void)
Definition: txtsrv.c:933
static void test_COM(void)
Definition: txtsrv.c:983
#define MEM_RELEASE
Definition: nt_native.h:1319
Definition: txthost.c:37
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:119
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ test_COM()

static void test_COM ( void  )
static

Definition at line 983 of file txtsrv.c.

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}
static const IUnknownVtbl unk_vtbl
Definition: txtsrv.c:976
HRESULT hr
Definition: shlfolder.c:183
IUnknown IUnknown_iface
Definition: api.c:545
IUnknown * inner_unk
Definition: api.c:547
LONG ref
Definition: api.c:546

Referenced by START_TEST().

◆ test_default_format()

static void test_default_format ( void  )
static

Definition at line 1119 of file txtsrv.c.

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}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
unsigned long DWORD
Definition: ntddk_ex.h:95
#define wine_dbgstr_w
Definition: kernel32.h:34
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
#define ITextServices_TxSendMessage(This, a, b, c, d)
Definition: txtsrv.c:79
static HRESULT __thiscall ITextHostImpl_TxGetCharFormat(ITextHost *iface, const CHARFORMATW **ppCF)
Definition: txtsrv.c:339
#define CFE_AUTOCOLOR
Definition: richedit.h:414
#define SCF_DEFAULT
Definition: richedit.h:234
#define EM_GETCHARFORMAT
Definition: richedit.h:91
#define CFE_AUTOBACKCOLOR
Definition: richedit.h:425
struct _charformat2w CHARFORMAT2W
BYTE bCharSet
Definition: richedit.h:311
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

Referenced by START_TEST().

◆ test_IIDs()

static void test_IIDs ( void  )
static

Definition at line 933 of file txtsrv.c.

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}
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197

Referenced by START_TEST().

◆ test_inplace_active()

static void test_inplace_active ( BOOL  active)
static

Definition at line 1403 of file txtsrv.c.

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}
#define ITextServices_TxDraw(This, a, b, c, d, e, f, g, h, i, j, k, l)
Definition: txtsrv.c:80
#define CLEAR_COUNTER(func)
Definition: txtsrv.c:59
static const WCHAR lorem[]
Definition: txtsrv.c:124
#define ITextServices_OnTxInPlaceActivate(This, a)
Definition: txtsrv.c:85
#define CHECK_CALLED(func)
Definition: txtsrv.c:49
#define ITextServices_OnTxPropertyBitsChange(This, a, b)
Definition: txtsrv.c:95
#define CHECK_NOT_CALLED(func)
Definition: txtsrv.c:54
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define EM_SETEVENTMASK
Definition: richedit.h:102
#define ENM_REQUESTRESIZE
Definition: richedit.h:477
#define TXTBIT_WORDWRAP
Definition: textserv.h:195
#define TXTBIT_MULTILINE
Definition: textserv.h:186
#define TXTBIT_SCROLLBARCHANGE
Definition: textserv.h:201
#define TXTBIT_RICHTEXT
Definition: textserv.h:185
@ TXTVIEW_INACTIVE
Definition: textserv.h:182
#define RECT
Definition: precomp.h:26
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 EM_REPLACESEL
Definition: winuser.h:2035
#define EM_SETSEL
Definition: winuser.h:2047
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ test_notifications()

static void test_notifications ( void  )
static

Definition at line 1226 of file txtsrv.c.

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}
#define ITextServices_TxSetText(This, a)
Definition: txtsrv.c:90
#define ENM_SCROLL
Definition: richedit.h:470
static FILE * client
Definition: client.c:37
@ TXTVIEW_ACTIVE
Definition: textserv.h:181
#define MAKEWPARAM(l, h)
Definition: winuser.h:4111
#define SB_THUMBTRACK
Definition: winuser.h:573
#define WM_VSCROLL
Definition: winuser.h:1772
#define SB_BOTTOM
Definition: winuser.h:577
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_THUMBPOSITION
Definition: winuser.h:572

Referenced by START_TEST().

◆ test_QueryInterface()

static void test_QueryInterface ( void  )
static

Definition at line 1013 of file txtsrv.c.

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}
HRESULT hres
Definition: protocol.c:465
static ULONG get_refcount(IUnknown *iface)
Definition: txtsrv.c:1007

Referenced by START_TEST().

◆ test_scrollcaret()

static void test_scrollcaret ( void  )
static

Definition at line 1386 of file txtsrv.c.

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}
#define EM_SCROLLCARET
Definition: richedit.h:81

Referenced by START_TEST().

◆ test_set_selection_message()

static void test_set_selection_message ( void  )
static

Definition at line 1282 of file txtsrv.c.

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}
#define trace
Definition: atltest.h:70
#define L(x)
Definition: resources.c:13
GLenum GLint * range
Definition: glext.h:7539
int winetest_debug
#define ENM_CHANGE
Definition: richedit.h:468
#define ENM_SELCHANGE
Definition: richedit.h:478
#define EM_EXSETSEL
Definition: richedit.h:88
#define EM_EXGETSEL
Definition: richedit.h:85

Referenced by START_TEST().

◆ test_TxDraw()

static void test_TxDraw ( void  )
static

Definition at line 854 of file txtsrv.c.

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}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
static HDC
Definition: imagelist.c:88
#define ITextServices_OnTxInPlaceDeactivate(This)
Definition: txtsrv.c:86
#define TXTBIT_CLIENTRECTCHANGE
Definition: textserv.h:205
#define E_UNEXPECTED
Definition: winerror.h:3528

Referenced by START_TEST().

◆ test_TxGetNaturalSize()

static void test_TxGetNaturalSize ( void  )
static

Definition at line 805 of file txtsrv.c.

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}
#define CHECK_TXGETNATURALSIZE(res, width, height, hdc, rect, string)
Definition: txtsrv.c:788
#define ITextServices_TxGetNaturalSize(This, a, b, c, d, e, f, g, h)
Definition: txtsrv.c:93
#define EM_SETCHARFORMAT
Definition: richedit.h:101
@ TXTNS_FITTOCONTENT
Definition: textserv.h:176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
int WINAPI SetMapMode(_In_ HDC, _In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define MM_TEXT
Definition: wingdi.h:873
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_TxGetScroll()

static void test_TxGetScroll ( void  )
static

Definition at line 1149 of file txtsrv.c.

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}
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
#define ITextServices_TxGetHScroll(This, a, b, c, d, e)
Definition: txtsrv.c:81
#define ITextServices_TxGetVScroll(This, a, b, c, d, e)
Definition: txtsrv.c:82
#define ES_DISABLENOSCROLL
Definition: richedit.h:224
Definition: module.h:576

Referenced by START_TEST().

◆ test_TxGetText()

static void test_TxGetText ( void  )
static

Definition at line 709 of file txtsrv.c.

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}
OLECHAR * BSTR
Definition: compat.h:2293
#define lstrlenW
Definition: compat.h:750
#define debugstr_w
Definition: kernel32.h:32
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
#define ITextServices_TxGetText(This, a)
Definition: txtsrv.c:89
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

Referenced by START_TEST().

◆ test_TxSetText()

static void test_TxSetText ( void  )
static

Definition at line 749 of file txtsrv.c.

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}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:215
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196

Referenced by START_TEST().

◆ unk_AddRef()

static ULONG WINAPI unk_AddRef ( IUnknown iface)
static

Definition at line 962 of file txtsrv.c.

963{
964 struct unk_impl *This = impl_from_IUnknown(iface);
965
966 return InterlockedIncrement(&This->ref);
967}
static struct text_services * impl_from_IUnknown(IUnknown *iface)
Definition: txtsrv.c:36

◆ unk_QueryInterface()

static HRESULT WINAPI unk_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 955 of file txtsrv.c.

956{
957 struct unk_impl *This = impl_from_IUnknown(iface);
958
959 return IUnknown_QueryInterface(This->inner_unk, riid, ppv);
960}
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ unk_Release()

static ULONG WINAPI unk_Release ( IUnknown iface)
static

Definition at line 969 of file txtsrv.c.

970{
971 struct unk_impl *This = impl_from_IUnknown(iface);
972
973 return InterlockedDecrement(&This->ref);
974}

Variable Documentation

◆ en_change_sent

int en_change_sent
static

Definition at line 431 of file txtsrv.c.

Referenced by ITextHostImpl_TxNotify(), and test_set_selection_message().

◆ en_selchange_sent

int en_selchange_sent
static

Definition at line 432 of file txtsrv.c.

Referenced by ITextHostImpl_TxNotify(), and test_set_selection_message().

◆ en_update_sent

int en_update_sent
static

Definition at line 430 of file txtsrv.c.

Referenced by ITextHostImpl_TxNotify(), and test_notifications().

◆ en_vscroll_sent

int en_vscroll_sent
static

Definition at line 429 of file txtsrv.c.

Referenced by ITextHostImpl_TxNotify(), and test_notifications().

◆ hmoduleRichEdit

HMODULE hmoduleRichEdit
static

Definition at line 62 of file txtsrv.c.

Referenced by START_TEST().

◆ itextHostVtbl

ITextHostVtbl itextHostVtbl
static

Definition at line 485 of file txtsrv.c.

Referenced by init_texthost(), setup_thiscall_wrappers(), and test_COM().

◆ lorem

const WCHAR lorem[]
static
Initial value:
= L"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "
"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. "
"Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

Definition at line 124 of file txtsrv.c.

Referenced by test_inplace_active(), test_notifications(), test_set_selection_message(), and test_TxGetScroll().

◆ pCreateTextServices

PCreateTextServices pCreateTextServices
static

Definition at line 66 of file txtsrv.c.

Referenced by init_texthost(), START_TEST(), and test_COM().

◆ pIID_ITextHost

IID* pIID_ITextHost
static

Definition at line 64 of file txtsrv.c.

Referenced by ITextHostImpl_QueryInterface(), START_TEST(), and test_IIDs().

◆ pIID_ITextHost2

IID* pIID_ITextHost2
static

Definition at line 65 of file txtsrv.c.

Referenced by START_TEST(), and test_IIDs().

◆ pIID_ITextServices

IID* pIID_ITextServices
static

Definition at line 63 of file txtsrv.c.

Referenced by disable_beep(), init_texthost(), START_TEST(), test_COM(), and test_IIDs().

◆ unk_vtbl

const IUnknownVtbl unk_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI unk_Release(IUnknown *iface)
Definition: txtsrv.c:969
static HRESULT WINAPI unk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: txtsrv.c:955
static ULONG WINAPI unk_AddRef(IUnknown *iface)
Definition: txtsrv.c:962

Definition at line 976 of file txtsrv.c.

Referenced by test_COM().

◆ wrapperCodeMem

void* wrapperCodeMem = NULL
static

Definition at line 530 of file txtsrv.c.

Referenced by setup_thiscall_wrappers(), and START_TEST().