ReactOS  0.4.14-dev-593-g1793dcc
inputprocessor.c File Reference
#include <stdio.h>
#include "wine/test.h"
#include "winuser.h"
#include "initguid.h"
#include "shlwapi.h"
#include "shlguid.h"
#include "comcat.h"
#include "msctf.h"
#include "olectl.h"
Include dependency graph for inputprocessor.c:

Go to the source code of this file.

Classes

struct  tagTextStoreACP
 
struct  tagThreadMgrEventSink
 
struct  tagClassFactory
 
struct  tagTextService
 
struct  tagKeyEventSink
 
struct  tagTextEditSink
 
struct  tagEditSession
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define SINK_UNEXPECTED   0
 
#define SINK_EXPECTED   1
 
#define SINK_FIRED   2
 
#define SINK_IGNORE   3
 
#define SINK_OPTIONAL   4
 
#define SINK_SAVE   5
 
#define SINK_ACTION_MASK   0xff
 
#define SINK_OPTION_MASK   0xff00
 
#define SINK_EXPECTED_COUNT_MASK   0xff0000
 
#define SINK_OPTION_TODO   0x0100
 
#define FOCUS_IGNORE   (ITfDocumentMgr*)0xffffffff
 
#define FOCUS_SAVE   (ITfDocumentMgr*)0xfffffffe
 
#define sink_fire_ok(a, b)   (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _sink_fire_ok(a,b)
 
#define sink_check_ok(a, b)   (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _sink_check_ok(a,b)
 
#define sink_check_saved(s, p, c, n)   (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _sink_check_saved(s,p,c,n)
 

Typedefs

typedef struct tagTextStoreACP TextStoreACP
 
typedef struct tagThreadMgrEventSink ThreadMgrEventSink
 
typedef HRESULT(* LPFNCONSTRUCTOR) (IUnknown *pUnkOuter, IUnknown **ppvOut)
 
typedef struct tagClassFactory ClassFactory
 
typedef struct tagTextService TextService
 
typedef struct tagKeyEventSink KeyEventSink
 
typedef struct tagTextEditSink TextEditSink
 
typedef struct tagEditSession EditSession
 

Functions

 DEFINE_GUID (CLSID_FakeService, 0xEDE1A7AD, 0x66DE, 0x47E0, 0xB6, 0x20, 0x3E, 0x92, 0xF8, 0x24, 0x6B, 0xF3)
 
static int expected_count (int *sink)
 
static void _sink_fire_ok (INT *sink, const CHAR *name)
 
static void _sink_check_ok (INT *sink, const CHAR *name)
 
static void _sink_check_saved (INT *sink, ITfDocumentMgr *PrevFocus, ITfDocumentMgr *CurrentFocus, const CHAR *name)
 
static TextStoreACPimpl_from_ITextStoreACP (ITextStoreACP *iface)
 
static void TextStoreACP_Destructor (TextStoreACP *This)
 
static HRESULT WINAPI TextStoreACP_QueryInterface (ITextStoreACP *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI TextStoreACP_AddRef (ITextStoreACP *iface)
 
static ULONG WINAPI TextStoreACP_Release (ITextStoreACP *iface)
 
static HRESULT WINAPI TextStoreACP_AdviseSink (ITextStoreACP *iface, REFIID riid, IUnknown *punk, DWORD dwMask)
 
static HRESULT WINAPI TextStoreACP_UnadviseSink (ITextStoreACP *iface, IUnknown *punk)
 
static HRESULT WINAPI TextStoreACP_RequestLock (ITextStoreACP *iface, DWORD dwLockFlags, HRESULT *phrSession)
 
static HRESULT WINAPI TextStoreACP_GetStatus (ITextStoreACP *iface, TS_STATUS *pdcs)
 
static HRESULT WINAPI TextStoreACP_QueryInsert (ITextStoreACP *iface, LONG acpTestStart, LONG acpTestEnd, ULONG cch, LONG *pacpResultStart, LONG *pacpResultEnd)
 
static HRESULT WINAPI TextStoreACP_GetSelection (ITextStoreACP *iface, ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched)
 
static HRESULT WINAPI TextStoreACP_SetSelection (ITextStoreACP *iface, ULONG ulCount, const TS_SELECTION_ACP *pSelection)
 
static HRESULT WINAPI TextStoreACP_GetText (ITextStoreACP *iface, LONG acpStart, LONG acpEnd, WCHAR *pchPlain, ULONG cchPlainReq, ULONG *pcchPlainRet, TS_RUNINFO *prgRunInfo, ULONG cRunInfoReq, ULONG *pcRunInfoRet, LONG *pacpNext)
 
static HRESULT WINAPI TextStoreACP_SetText (ITextStoreACP *iface, DWORD dwFlags, LONG acpStart, LONG acpEnd, const WCHAR *pchText, ULONG cch, TS_TEXTCHANGE *pChange)
 
static HRESULT WINAPI TextStoreACP_GetFormattedText (ITextStoreACP *iface, LONG acpStart, LONG acpEnd, IDataObject **ppDataObject)
 
static HRESULT WINAPI TextStoreACP_GetEmbedded (ITextStoreACP *iface, LONG acpPos, REFGUID rguidService, REFIID riid, IUnknown **ppunk)
 
static HRESULT WINAPI TextStoreACP_QueryInsertEmbedded (ITextStoreACP *iface, const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable)
 
static HRESULT WINAPI TextStoreACP_InsertEmbedded (ITextStoreACP *iface, DWORD dwFlags, LONG acpStart, LONG acpEnd, IDataObject *pDataObject, TS_TEXTCHANGE *pChange)
 
static HRESULT WINAPI TextStoreACP_InsertTextAtSelection (ITextStoreACP *iface, DWORD dwFlags, const WCHAR *pchText, ULONG cch, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange)
 
static HRESULT WINAPI TextStoreACP_InsertEmbeddedAtSelection (ITextStoreACP *iface, DWORD dwFlags, IDataObject *pDataObject, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange)
 
static HRESULT WINAPI TextStoreACP_RequestSupportedAttrs (ITextStoreACP *iface, DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs)
 
static HRESULT WINAPI TextStoreACP_RequestAttrsAtPosition (ITextStoreACP *iface, LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags)
 
static HRESULT WINAPI TextStoreACP_RequestAttrsTransitioningAtPosition (ITextStoreACP *iface, LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags)
 
static HRESULT WINAPI TextStoreACP_FindNextAttrTransition (ITextStoreACP *iface, LONG acpStart, LONG acpHalt, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags, LONG *pacpNext, BOOL *pfFound, LONG *plFoundOffset)
 
static HRESULT WINAPI TextStoreACP_RetrieveRequestedAttrs (ITextStoreACP *iface, ULONG ulCount, TS_ATTRVAL *paAttrVals, ULONG *pcFetched)
 
static HRESULT WINAPI TextStoreACP_GetEndACP (ITextStoreACP *iface, LONG *pacp)
 
static HRESULT WINAPI TextStoreACP_GetActiveView (ITextStoreACP *iface, TsViewCookie *pvcView)
 
static HRESULT WINAPI TextStoreACP_GetACPFromPoint (ITextStoreACP *iface, TsViewCookie vcView, const POINT *ptScreen, DWORD dwFlags, LONG *pacp)
 
static HRESULT WINAPI TextStoreACP_GetTextExt (ITextStoreACP *iface, TsViewCookie vcView, LONG acpStart, LONG acpEnd, RECT *prc, BOOL *pfClipped)
 
static HRESULT WINAPI TextStoreACP_GetScreenExt (ITextStoreACP *iface, TsViewCookie vcView, RECT *prc)
 
static HRESULT WINAPI TextStoreACP_GetWnd (ITextStoreACP *iface, TsViewCookie vcView, HWND *phwnd)
 
static HRESULT TextStoreACP_Constructor (IUnknown **ppOut)
 
static ThreadMgrEventSinkimpl_from_ITfThreadMgrEventSink (ITfThreadMgrEventSink *iface)
 
static void ThreadMgrEventSink_Destructor (ThreadMgrEventSink *This)
 
static HRESULT WINAPI ThreadMgrEventSink_QueryInterface (ITfThreadMgrEventSink *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI ThreadMgrEventSink_AddRef (ITfThreadMgrEventSink *iface)
 
static ULONG WINAPI ThreadMgrEventSink_Release (ITfThreadMgrEventSink *iface)
 
static HRESULT WINAPI ThreadMgrEventSink_OnInitDocumentMgr (ITfThreadMgrEventSink *iface, ITfDocumentMgr *pdim)
 
static HRESULT WINAPI ThreadMgrEventSink_OnUninitDocumentMgr (ITfThreadMgrEventSink *iface, ITfDocumentMgr *pdim)
 
static HRESULT WINAPI ThreadMgrEventSink_OnSetFocus (ITfThreadMgrEventSink *iface, ITfDocumentMgr *pdimFocus, ITfDocumentMgr *pdimPrevFocus)
 
static HRESULT WINAPI ThreadMgrEventSink_OnPushContext (ITfThreadMgrEventSink *iface, ITfContext *pic)
 
static HRESULT WINAPI ThreadMgrEventSink_OnPopContext (ITfThreadMgrEventSink *iface, ITfContext *pic)
 
static HRESULT ThreadMgrEventSink_Constructor (IUnknown **ppOut)
 
static HRESULT WINAPI TfKeyTraceEventSink_QueryInterface (ITfKeyTraceEventSink *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI TfKeyTraceEventSink_AddRef (ITfKeyTraceEventSink *iface)
 
static ULONG WINAPI TfKeyTraceEventSink_Release (ITfKeyTraceEventSink *iface)
 
static HRESULT WINAPI TfKeyTraceEventSink_OnKeyTraceDown (ITfKeyTraceEventSink *iface, WPARAM wparam, LPARAM lparam)
 
static HRESULT WINAPI TfKeyTraceEventSink_OnKeyTraceUp (ITfKeyTraceEventSink *iface, WPARAM wparam, LPARAM lparam)
 
static HRESULT WINAPI TfUIElementSink_QueryInterface (ITfUIElementSink *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI TfUIElementSink_AddRef (ITfUIElementSink *iface)
 
static ULONG WINAPI TfUIElementSink_Release (ITfUIElementSink *iface)
 
static HRESULT WINAPI TfUIElementSink_BeginUIElement (ITfUIElementSink *iface, DWORD id, BOOL *show)
 
static HRESULT WINAPI TfUIElementSink_UpdateUIElement (ITfUIElementSink *iface, DWORD id)
 
static HRESULT WINAPI TfUIElementSink_EndUIElement (ITfUIElementSink *iface, DWORD id)
 
static HRESULT WINAPI ProfileActivationSink_QueryInterface (ITfInputProcessorProfileActivationSink *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI ProfileActivationSink_AddRef (ITfInputProcessorProfileActivationSink *iface)
 
static ULONG WINAPI ProfileActivationSink_Release (ITfInputProcessorProfileActivationSink *iface)
 
static HRESULT WINAPI ProfileActivationSink_OnActivated (ITfInputProcessorProfileActivationSink *iface, DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
 
static HRESULT WINAPI TfTransitoryExtensionSink_QueryInterface (ITfTransitoryExtensionSink *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI TfTransitoryExtensionSink_AddRef (ITfTransitoryExtensionSink *iface)
 
static ULONG WINAPI TfTransitoryExtensionSink_Release (ITfTransitoryExtensionSink *iface)
 
static HRESULT WINAPI TfTransitoryExtensionSink_OnTransitoryExtensionUpdated (ITfTransitoryExtensionSink *iface, ITfContext *pic, TfEditCookie ecReadOnly, ITfRange *pResultRange, ITfRange *pCompositionRange, BOOL *pfDeleteResultRange)
 
static ClassFactoryimpl_from_IClassFactory (IClassFactory *iface)
 
static TextServiceimpl_from_ITfTextInputProcessor (ITfTextInputProcessor *iface)
 
static void ClassFactory_Destructor (ClassFactory *This)
 
static HRESULT WINAPI ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
 
static ULONG WINAPI ClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_CreateInstance (IClassFactory *iface, IUnknown *punkOuter, REFIID iid, LPVOID *ppvOut)
 
static HRESULT WINAPI ClassFactory_LockServer (IClassFactory *iface, BOOL fLock)
 
static HRESULT ClassFactory_Constructor (LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
 
static void TextService_Destructor (TextService *This)
 
static HRESULT WINAPI TextService_QueryInterface (ITfTextInputProcessor *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI TextService_AddRef (ITfTextInputProcessor *iface)
 
static ULONG WINAPI TextService_Release (ITfTextInputProcessor *iface)
 
static HRESULT WINAPI TextService_Activate (ITfTextInputProcessor *iface, ITfThreadMgr *ptim, TfClientId id)
 
static HRESULT WINAPI TextService_Deactivate (ITfTextInputProcessor *iface)
 
static HRESULT TextService_Constructor (IUnknown *pUnkOuter, IUnknown **ppOut)
 
static HRESULT RegisterTextService (REFCLSID rclsid)
 
static HRESULT UnregisterTextService (void)
 
 DEFINE_GUID (CLSID_TF_InputProcessorProfiles, 0x33c53a50, 0xf456, 0x4884, 0xb0, 0x49, 0x85, 0xfd, 0x64, 0x3e, 0xcf, 0xed)
 
 DEFINE_GUID (CLSID_TF_CategoryMgr, 0xA4B544A1, 0x438D, 0x4B41, 0x93, 0x25, 0x86, 0x95, 0x23, 0xE2, 0xD6, 0xC7)
 
 DEFINE_GUID (GUID_TFCAT_TIP_KEYBOARD, 0x34745c63, 0xb2f0, 0x4784, 0x8b, 0x67, 0x5e, 0x12, 0xc8, 0x70, 0x1a, 0x31)
 
 DEFINE_GUID (GUID_TFCAT_TIP_SPEECH, 0xB5A73CD1, 0x8355, 0x426B, 0xA1, 0x61, 0x25, 0x98, 0x08, 0xF2, 0x6B, 0x14)
 
 DEFINE_GUID (GUID_TFCAT_TIP_HANDWRITING, 0x246ecb87, 0xc2f2, 0x4abe, 0x90, 0x5b, 0xc8, 0xb3, 0x8a, 0xdd, 0x2c, 0x43)
 
 DEFINE_GUID (GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER, 0x046B8C80, 0x1647, 0x40F7, 0x9B, 0x21, 0xB9, 0x3B, 0x81, 0xAA, 0xBC, 0x1B)
 
 DEFINE_GUID (GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
 DEFINE_GUID (CLSID_TF_ThreadMgr, 0x529a9e6b, 0x6587, 0x4f23, 0xab, 0x9e, 0x9c, 0x7d, 0x68, 0x3e, 0x3c, 0x50)
 
 DEFINE_GUID (CLSID_PreservedKey, 0xA0ED8E55, 0xCD3B, 0x4274, 0xB2, 0x95, 0xF6, 0xC9, 0xBA, 0x2B, 0x84, 0x72)
 
 DEFINE_GUID (GUID_COMPARTMENT_KEYBOARD_DISABLED, 0x71a5b253, 0x1951, 0x466b, 0x9f, 0xbc, 0x9c, 0x88, 0x08, 0xfa, 0x84, 0xf2)
 
 DEFINE_GUID (GUID_COMPARTMENT_KEYBOARD_OPENCLOSE, 0x58273aad, 0x01bb, 0x4164, 0x95, 0xc6, 0x75, 0x5b, 0xa0, 0xb5, 0x16, 0x2d)
 
 DEFINE_GUID (GUID_COMPARTMENT_HANDWRITING_OPENCLOSE, 0xf9ae2c6b, 0x1866, 0x4361, 0xaf, 0x72, 0x7a, 0xa3, 0x09, 0x48, 0x89, 0x0e)
 
 DEFINE_GUID (GUID_COMPARTMENT_SPEECH_DISABLED, 0x56c5c607, 0x0703, 0x4e59, 0x8e, 0x52, 0xcb, 0xc8, 0x4e, 0x8b, 0xbe, 0x35)
 
 DEFINE_GUID (GUID_COMPARTMENT_SPEECH_OPENCLOSE, 0x544d6a63, 0xe2e8, 0x4752, 0xbb, 0xd1, 0x00, 0x09, 0x60, 0xbc, 0xa0, 0x83)
 
 DEFINE_GUID (GUID_COMPARTMENT_SPEECH_GLOBALSTATE, 0x2a54fe8e, 0x0d08, 0x460c, 0xa7, 0x5d, 0x87, 0x03, 0x5f, 0xf4, 0x36, 0xc5)
 
 DEFINE_GUID (GUID_COMPARTMENT_PERSISTMENUENABLED, 0x575f3783, 0x70c8, 0x47c8, 0xae, 0x5d, 0x91, 0xa0, 0x1a, 0x1f, 0x75, 0x92)
 
 DEFINE_GUID (GUID_COMPARTMENT_EMPTYCONTEXT, 0xd7487dbf, 0x804e, 0x41c5, 0x89, 0x4d, 0xad, 0x96, 0xfd, 0x4e, 0xea, 0x13)
 
 DEFINE_GUID (GUID_COMPARTMENT_TIPUISTATUS, 0x148ca3ec, 0x0366, 0x401c, 0x8d, 0x75, 0xed, 0x97, 0x8d, 0x85, 0xfb, 0xc9)
 
static HRESULT initialize (void)
 
static void cleanup (void)
 
static void test_Register (void)
 
static void test_Unregister (void)
 
static void test_EnumInputProcessorInfo (void)
 
static void test_EnumLanguageProfiles (void)
 
static void test_RegisterCategory (void)
 
static void test_UnregisterCategory (void)
 
static void test_FindClosestCategory (void)
 
static void test_Enable (void)
 
static void test_Disable (void)
 
static void test_ThreadMgrAdviseSinks (void)
 
static void test_ThreadMgrUnadviseSinks (void)
 
static void test_DocumentMgrAdviseSinks (void)
 
static void test_DocumentMgrUnadviseSinks (void)
 
static KeyEventSinkimpl_from_ITfKeyEventSink (ITfKeyEventSink *iface)
 
static void KeyEventSink_Destructor (KeyEventSink *This)
 
static HRESULT WINAPI KeyEventSink_QueryInterface (ITfKeyEventSink *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI KeyEventSink_AddRef (ITfKeyEventSink *iface)
 
static ULONG WINAPI KeyEventSink_Release (ITfKeyEventSink *iface)
 
static HRESULT WINAPI KeyEventSink_OnSetFocus (ITfKeyEventSink *iface, BOOL fForeground)
 
static HRESULT WINAPI KeyEventSink_OnTestKeyDown (ITfKeyEventSink *iface, ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
 
static HRESULT WINAPI KeyEventSink_OnTestKeyUp (ITfKeyEventSink *iface, ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
 
static HRESULT WINAPI KeyEventSink_OnKeyDown (ITfKeyEventSink *iface, ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
 
static HRESULT WINAPI KeyEventSink_OnKeyUp (ITfKeyEventSink *iface, ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
 
static HRESULT WINAPI KeyEventSink_OnPreservedKey (ITfKeyEventSink *iface, ITfContext *pic, REFGUID rguid, BOOL *pfEaten)
 
static HRESULT KeyEventSink_Constructor (ITfKeyEventSink **ppOut)
 
static void test_KeystrokeMgr (void)
 
static void test_Activate (void)
 
static void test_EnumContexts (ITfDocumentMgr *dm, ITfContext *search)
 
static void test_EnumDocumentMgr (ITfThreadMgr *tm, ITfDocumentMgr *search, ITfDocumentMgr *absent)
 
static int check_context_refcount (ITfContext *iface)
 
static TextEditSinkimpl_from_ITfTextEditSink (ITfTextEditSink *iface)
 
static void TextEditSink_Destructor (TextEditSink *This)
 
static HRESULT WINAPI TextEditSink_QueryInterface (ITfTextEditSink *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI TextEditSink_AddRef (ITfTextEditSink *iface)
 
static ULONG WINAPI TextEditSink_Release (ITfTextEditSink *iface)
 
static HRESULT WINAPI TextEditSink_OnEndEdit (ITfTextEditSink *iface, ITfContext *pic, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord)
 
static HRESULT TextEditSink_Constructor (ITfTextEditSink **ppOut)
 
static void test_startSession (void)
 
static void test_endSession (void)
 
static void test_TfGuidAtom (void)
 
static void test_ClientId (void)
 
static EditSessionimpl_from_ITfEditSession (ITfEditSession *iface)
 
static void EditSession_Destructor (EditSession *This)
 
static HRESULT WINAPI EditSession_QueryInterface (ITfEditSession *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI EditSession_AddRef (ITfEditSession *iface)
 
static ULONG WINAPI EditSession_Release (ITfEditSession *iface)
 
static void test_InsertAtSelection (TfEditCookie ec, ITfContext *cxt)
 
static HRESULT WINAPI EditSession_DoEditSession (ITfEditSession *iface, TfEditCookie ec)
 
static HRESULT EditSession_Constructor (ITfEditSession **ppOut)
 
static void test_TStoApplicationText (void)
 
static void enum_compartments (ITfCompartmentMgr *cmpmgr, REFGUID present, REFGUID absent)
 
static void test_Compartments (void)
 
static void processPendingMessages (void)
 
static void test_AssociateFocus (void)
 
static void test_profile_mgr (void)
 
static DWORD WINAPI test_MultiThreadApartment_Thread (void *param)
 
static void test_MultiThreadApartment (void)
 
 START_TEST (inputprocessor)
 

Variables

static ITfInputProcessorProfiles * g_ipp
 
static LANGID gLangid
 
static ITfCategoryMgrg_cm = NULL
 
static ITfThreadMgrg_tm = NULL
 
static ITfDocumentMgrg_dm = NULL
 
static TfClientId cid = 0
 
static TfClientId tid = 0
 
static ITextStoreACPSinkACPSink
 
static BOOL test_ShouldActivate = FALSE
 
static BOOL test_ShouldDeactivate = FALSE
 
static DWORD tmSinkCookie
 
static DWORD tmSinkRefCount
 
static DWORD dmSinkCookie
 
static DWORD documentStatus
 
static DWORD key_trace_sink_cookie
 
static DWORD ui_element_sink_cookie
 
static DWORD profile_activation_sink_cookie
 
static DWORD fake_service_onactivated_flags = 0
 
static ITfDocumentMgrtest_CurrentFocus = NULL
 
static ITfDocumentMgrtest_PrevFocus = NULL
 
static ITfDocumentMgrtest_LastCurrentFocus = FOCUS_SAVE
 
static ITfDocumentMgrtest_FirstPrevFocus = FOCUS_SAVE
 
static INT test_OnSetFocus = SINK_UNEXPECTED
 
static INT test_OnInitDocumentMgr = SINK_UNEXPECTED
 
static INT test_OnPushContext = SINK_UNEXPECTED
 
static INT test_OnPopContext = SINK_UNEXPECTED
 
static INT test_KEV_OnSetFocus = SINK_UNEXPECTED
 
static INT test_ACP_AdviseSink = SINK_UNEXPECTED
 
static INT test_ACP_UnadviseSink = SINK_UNEXPECTED
 
static INT test_ACP_GetStatus = SINK_UNEXPECTED
 
static INT test_ACP_RequestLock = SINK_UNEXPECTED
 
static INT test_ACP_GetEndACP = SINK_UNEXPECTED
 
static INT test_ACP_GetSelection = SINK_UNEXPECTED
 
static INT test_DoEditSession = SINK_UNEXPECTED
 
static INT test_ACP_InsertTextAtSelection = SINK_UNEXPECTED
 
static INT test_ACP_SetSelection = SINK_UNEXPECTED
 
static INT test_OnEndEdit = SINK_UNEXPECTED
 
static const ITextStoreACPVtbl TextStoreACP_TextStoreACPVtbl
 
static const ITfThreadMgrEventSinkVtbl ThreadMgrEventSink_ThreadMgrEventSinkVtbl
 
static const ITfKeyTraceEventSinkVtbl TfKeyTraceEventSinkVtbl
 
static ITfKeyTraceEventSink TfKeyTraceEventSink = { &TfKeyTraceEventSinkVtbl }
 
static const ITfUIElementSinkVtbl TfUIElementSinkVtbl
 
static ITfUIElementSink TfUIElementSink = { &TfUIElementSinkVtbl }
 
static const ITfInputProcessorProfileActivationSinkVtbl TfInputProcessorProfileActivationSinkVtbl
 
static ITfInputProcessorProfileActivationSink TfInputProcessorProfileActivationSink
 
static const ITfTransitoryExtensionSinkVtbl TfTransitoryExtensionSinkVtbl
 
static ITfTransitoryExtensionSink TfTransitoryExtensionSink = { &TfTransitoryExtensionSinkVtbl }
 
static LONG TS_refCount
 
static IClassFactorycf
 
static DWORD regid
 
static const IClassFactoryVtbl ClassFactoryVtbl
 
static const ITfTextInputProcessorVtbl TextService_TextInputProcessorVtbl
 
static const ITfKeyEventSinkVtbl KeyEventSink_KeyEventSinkVtbl
 
static const ITfTextEditSinkVtbl TextEditSink_TextEditSinkVtbl
 
static const ITfEditSessionVtbl EditSession_EditSessionVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file inputprocessor.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 24 of file inputprocessor.c.

◆ FOCUS_IGNORE

#define FOCUS_IGNORE   (ITfDocumentMgr*)0xffffffff

Definition at line 57 of file inputprocessor.c.

◆ FOCUS_SAVE

#define FOCUS_SAVE   (ITfDocumentMgr*)0xfffffffe

Definition at line 58 of file inputprocessor.c.

◆ SINK_ACTION_MASK

#define SINK_ACTION_MASK   0xff

Definition at line 51 of file inputprocessor.c.

◆ sink_check_ok

#define sink_check_ok (   a,
  b 
)    (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _sink_check_ok(a,b)

Definition at line 159 of file inputprocessor.c.

◆ sink_check_saved

#define sink_check_saved (   s,
  p,
  c,
  n 
)    (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _sink_check_saved(s,p,c,n)

Definition at line 173 of file inputprocessor.c.

◆ SINK_EXPECTED

#define SINK_EXPECTED   1

Definition at line 45 of file inputprocessor.c.

◆ SINK_EXPECTED_COUNT_MASK

#define SINK_EXPECTED_COUNT_MASK   0xff0000

Definition at line 53 of file inputprocessor.c.

◆ sink_fire_ok

#define sink_fire_ok (   a,
  b 
)    (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _sink_fire_ok(a,b)

Definition at line 131 of file inputprocessor.c.

◆ SINK_FIRED

#define SINK_FIRED   2

Definition at line 46 of file inputprocessor.c.

◆ SINK_IGNORE

#define SINK_IGNORE   3

Definition at line 47 of file inputprocessor.c.

◆ SINK_OPTION_MASK

#define SINK_OPTION_MASK   0xff00

Definition at line 52 of file inputprocessor.c.

◆ SINK_OPTION_TODO

#define SINK_OPTION_TODO   0x0100

Definition at line 55 of file inputprocessor.c.

◆ SINK_OPTIONAL

#define SINK_OPTIONAL   4

Definition at line 48 of file inputprocessor.c.

◆ SINK_SAVE

#define SINK_SAVE   5

Definition at line 49 of file inputprocessor.c.

◆ SINK_UNEXPECTED

#define SINK_UNEXPECTED   0

Definition at line 44 of file inputprocessor.c.

Typedef Documentation

◆ ClassFactory

◆ EditSession

◆ KeyEventSink

◆ LPFNCONSTRUCTOR

typedef HRESULT(* LPFNCONSTRUCTOR) (IUnknown *pUnkOuter, IUnknown **ppvOut)

Definition at line 830 of file inputprocessor.c.

◆ TextEditSink

◆ TextService

◆ TextStoreACP

◆ ThreadMgrEventSink

Function Documentation

◆ _sink_check_ok()

static void _sink_check_ok ( INT sink,
const CHAR name 
)
inlinestatic

Definition at line 133 of file inputprocessor.c.

134 {
135  int action = *sink & SINK_ACTION_MASK;
136  int todo = *sink & SINK_OPTION_TODO;
137  int count = expected_count(sink);
138 
139  switch (action)
140  {
141  case SINK_OPTIONAL:
143  winetest_trace("optional sink %s not fired\n",name);
144  case SINK_FIRED:
145  break;
146  case SINK_IGNORE:
147  return;
148  case SINK_SAVE:
149  if (count == 0 && winetest_interactive)
150  winetest_trace("optional sink %s not fired\n",name);
151  break;
152  default:
154  winetest_ok(0, "%s not fired as expected, in state %x\n",name,*sink);
155  }
157 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
BOOL todo
Definition: filedlg.c:313
#define SINK_UNEXPECTED
int winetest_interactive
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
#define SINK_SAVE
#define SINK_OPTIONAL
#define SINK_FIRED
#define todo_wine_if(is_todo)
Definition: test.h:164
void __winetest_cdecl winetest_trace(const char *msg,...)
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
#define SINK_OPTION_TODO
#define SINK_ACTION_MASK
const WCHAR * action
Definition: action.c:7783
#define SINK_IGNORE
static int expected_count(int *sink)
Definition: name.c:38

Referenced by _sink_check_saved().

◆ _sink_check_saved()

static void _sink_check_saved ( INT sink,
ITfDocumentMgr PrevFocus,
ITfDocumentMgr CurrentFocus,
const CHAR name 
)
inlinestatic

Definition at line 161 of file inputprocessor.c.

162 {
163  int count = expected_count(sink);
165  if (PrevFocus != FOCUS_IGNORE && count != 0)
166  winetest_ok(PrevFocus == test_FirstPrevFocus, "%s expected prev focus %p got %p\n", name, PrevFocus, test_FirstPrevFocus);
167  if (CurrentFocus != FOCUS_IGNORE && count != 0)
168  winetest_ok(CurrentFocus == test_LastCurrentFocus, "%s expected current focus %p got %p\n", name, CurrentFocus, test_LastCurrentFocus);
171 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
static ITfDocumentMgr * test_LastCurrentFocus
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
#define FOCUS_IGNORE
static int expected_count(int *sink)
#define FOCUS_SAVE
Definition: name.c:38
static ITfDocumentMgr * test_FirstPrevFocus
static void _sink_check_ok(INT *sink, const CHAR *name)

◆ _sink_fire_ok()

static void _sink_fire_ok ( INT sink,
const CHAR name 
)
inlinestatic

Definition at line 96 of file inputprocessor.c.

97 {
98  int count;
99  int todo = *sink & SINK_OPTION_TODO;
100  int action = *sink & SINK_ACTION_MASK;
101 
103  winetest_trace("firing %s\n",name);
104 
105  switch (action)
106  {
107  case SINK_OPTIONAL:
108  case SINK_EXPECTED:
110  if (count > 1)
111  {
112  count --;
113  *sink = (*sink & ~SINK_EXPECTED_COUNT_MASK) + (count << 16);
114  return;
115  }
116  break;
117  case SINK_IGNORE:
118  winetest_trace("Ignoring %s\n",name);
119  return;
120  case SINK_SAVE:
121  count = expected_count(sink) + 1;
122  *sink = (*sink & ~SINK_EXPECTED_COUNT_MASK) + (count << 16);
123  return;
124  default:
126  winetest_ok(0, "Unexpected %s sink\n",name);
127  }
128  *sink = SINK_FIRED;
129 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
BOOL todo
Definition: filedlg.c:313
int winetest_interactive
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
#define SINK_SAVE
#define SINK_OPTIONAL
#define SINK_FIRED
#define SINK_EXPECTED
#define todo_wine_if(is_todo)
Definition: test.h:164
void __winetest_cdecl winetest_trace(const char *msg,...)
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
#define SINK_OPTION_TODO
#define SINK_EXPECTED_COUNT_MASK
#define SINK_ACTION_MASK
const WCHAR * action
Definition: action.c:7783
#define SINK_IGNORE
static int expected_count(int *sink)
Definition: name.c:38

◆ check_context_refcount()

static int check_context_refcount ( ITfContext iface)
inlinestatic

Definition at line 1572 of file inputprocessor.c.

1573 {
1574  ITfContext_AddRef(iface);
1575  return ITfContext_Release(iface);
1576 }

Referenced by test_startSession().

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 874 of file inputprocessor.c.

875 {
877  return InterlockedIncrement(&This->ref);
878 }
#define InterlockedIncrement
Definition: armddk.h:53
static ClassFactory * impl_from_IClassFactory(IClassFactory *iface)

◆ ClassFactory_Constructor()

static HRESULT ClassFactory_Constructor ( LPFNCONSTRUCTOR  ctor,
LPVOID ppvOut 
)
static

Definition at line 925 of file inputprocessor.c.

926 {
928  This->IClassFactory_iface.lpVtbl = &ClassFactoryVtbl;
929  This->ref = 1;
930  This->ctor = ctor;
931  *ppvOut = &This->IClassFactory_iface;
932  TS_refCount++;
933  return S_OK;
934 }
LPFNCONSTRUCTOR ctor
Definition: msctf.c:83
static const IClassFactoryVtbl ClassFactoryVtbl
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59
static LONG TS_refCount

Referenced by RegisterTextService().

◆ ClassFactory_CreateInstance()

static HRESULT WINAPI ClassFactory_CreateInstance ( IClassFactory iface,
IUnknown punkOuter,
REFIID  iid,
LPVOID ppvOut 
)
static

Definition at line 890 of file inputprocessor.c.

891 {
893  HRESULT ret;
894  IUnknown *obj;
895 
896  ret = This->ctor(punkOuter, &obj);
897  if (FAILED(ret))
898  return ret;
899  ret = IUnknown_QueryInterface(obj, iid, ppvOut);
900  IUnknown_Release(obj);
901  return ret;
902 }
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
LONG HRESULT
Definition: typedefs.h:77
int ret
static ClassFactory * impl_from_IClassFactory(IClassFactory *iface)

◆ ClassFactory_Destructor()

static void ClassFactory_Destructor ( ClassFactory This)
static

Definition at line 855 of file inputprocessor.c.

856 {
858  TS_refCount--;
859 }
#define GetProcessHeap()
Definition: compat.h:403
static LONG TS_refCount
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by ClassFactory_Release().

◆ ClassFactory_LockServer()

static HRESULT WINAPI ClassFactory_LockServer ( IClassFactory iface,
BOOL  fLock 
)
static

Definition at line 904 of file inputprocessor.c.

905 {
906  if(fLock)
908  else
910 
911  return S_OK;
912 }
#define InterlockedDecrement
Definition: armddk.h:52
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
static LONG TS_refCount

◆ ClassFactory_QueryInterface()

static HRESULT WINAPI ClassFactory_QueryInterface ( IClassFactory iface,
REFIID  riid,
LPVOID ppvOut 
)
static

Definition at line 861 of file inputprocessor.c.

862 {
863  *ppvOut = NULL;
865  {
866  IClassFactory_AddRef(iface);
867  *ppvOut = iface;
868  return S_OK;
869  }
870 
871  return E_NOINTERFACE;
872 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
const GUID IID_IClassFactory
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 880 of file inputprocessor.c.

881 {
884 
885  if (ret == 0)
887  return ret;
888 }
static void ClassFactory_Destructor(ClassFactory *This)
int ret
#define InterlockedDecrement
Definition: armddk.h:52
static ClassFactory * impl_from_IClassFactory(IClassFactory *iface)
unsigned int ULONG
Definition: retypes.h:1

◆ cleanup()

static void cleanup ( void  )
static

Definition at line 1079 of file inputprocessor.c.

1080 {
1081  if (g_ipp)
1082  ITfInputProcessorProfiles_Release(g_ipp);
1083  if (g_cm)
1084  ITfCategoryMgr_Release(g_cm);
1085  if (g_tm)
1086  ITfThreadMgr_Release(g_tm);
1087  CoUninitialize();
1088 }
static ITfCategoryMgr * g_cm
static ITfThreadMgr * g_tm
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static ITfInputProcessorProfiles * g_ipp

Referenced by START_TEST().

◆ DEFINE_GUID() [1/19]

DEFINE_GUID ( CLSID_FakeService  ,
0xEDE1A7AD  ,
0x66DE  ,
0x47E0  ,
0xB6  ,
0x20  ,
0x3E  ,
0x92  ,
0xF8  ,
0x24  ,
0x6B  ,
0xF3   
)

◆ DEFINE_GUID() [2/19]

DEFINE_GUID ( CLSID_TF_InputProcessorProfiles  ,
0x33c53a50  ,
0xf456  ,
0x4884  ,
0xb0  ,
0x49  ,
0x85  ,
0xfd  ,
0x64  ,
0x3e  ,
0xcf  ,
0xed   
)

◆ DEFINE_GUID() [3/19]

DEFINE_GUID ( CLSID_TF_CategoryMgr  ,
0xA4B544A1  ,
0x438D  ,
0x4B41  ,
0x93  ,
0x25  ,
0x86  ,
0x95  ,
0x23  ,
0xE2  ,
0xD6  ,
0xC7   
)

◆ DEFINE_GUID() [4/19]

DEFINE_GUID ( GUID_TFCAT_TIP_KEYBOARD  ,
0x34745c63  ,
0xb2f0  ,
0x4784  ,
0x8b  ,
0x67  ,
0x5e  ,
0x12  ,
0xc8  ,
0x70  ,
0x1a  ,
0x31   
)

◆ DEFINE_GUID() [5/19]

DEFINE_GUID ( GUID_TFCAT_TIP_SPEECH  ,
0xB5A73CD1  ,
0x8355  ,
0x426B  ,
0xA1  ,
0x61  ,
0x25  ,
0x98  ,
0x08  ,
0xF2  ,
0x6B  ,
0x14   
)

◆ DEFINE_GUID() [6/19]

DEFINE_GUID ( GUID_TFCAT_TIP_HANDWRITING  ,
0x246ecb87  ,
0xc2f2  ,
0x4abe  ,
0x90  ,
0x5b  ,
0xc8  ,
0xb3  ,
0x8a  ,
0xdd  ,
0x2c  ,
0x43   
)

◆ DEFINE_GUID() [7/19]

DEFINE_GUID ( GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER  ,
0x046B8C80  ,
0x1647  ,
0x40F7  ,
0x9B  ,
0x21  ,
0xB9  ,
0x3B  ,
0x81  ,
0xAA  ,
0xBC  ,
0x1B   
)

◆ DEFINE_GUID() [8/19]

DEFINE_GUID ( GUID_NULL  ,
,
,
,
,
,
,
,
,
,
,
 
)

◆ DEFINE_GUID() [9/19]

DEFINE_GUID ( CLSID_TF_ThreadMgr  ,
0x529a9e6b  ,
0x6587  ,
0x4f23  ,
0xab  ,
0x9e  ,
0x9c  ,
0x7d  ,
0x68  ,
0x3e  ,
0x3c  ,
0x50   
)

◆ DEFINE_GUID() [10/19]

DEFINE_GUID ( CLSID_PreservedKey  ,
0xA0ED8E55  ,
0xCD3B  ,
0x4274  ,
0xB2  ,
0x95  ,
0xF6  ,
0xC9  ,
0xBA  ,
0x2B  ,
0x84  ,
0x72   
)

◆ DEFINE_GUID() [11/19]

DEFINE_GUID ( GUID_COMPARTMENT_KEYBOARD_DISABLED  ,
0x71a5b253  ,
0x1951  ,
0x466b  ,
0x9f  ,
0xbc  ,
0x9c  ,
0x88  ,
0x08  ,
0xfa  ,
0x84  ,
0xf2   
)

◆ DEFINE_GUID() [12/19]

DEFINE_GUID ( GUID_COMPARTMENT_KEYBOARD_OPENCLOSE  ,
0x58273aad  ,
0x01bb  ,
0x4164  ,
0x95  ,
0xc6  ,
0x75  ,
0x5b  ,
0xa0  ,
0xb5  ,
0x16  ,
0x2d   
)

◆ DEFINE_GUID() [13/19]

DEFINE_GUID ( GUID_COMPARTMENT_HANDWRITING_OPENCLOSE  ,
0xf9ae2c6b  ,
0x1866  ,
0x4361  ,
0xaf  ,
0x72  ,
0x7a  ,
0xa3  ,
0x09  ,
0x48  ,
0x89  ,
0x0e   
)

◆ DEFINE_GUID() [14/19]

DEFINE_GUID ( GUID_COMPARTMENT_SPEECH_DISABLED  ,
0x56c5c607  ,
0x0703  ,
0x4e59  ,
0x8e  ,
0x52  ,
0xcb  ,
0xc8  ,
0x4e  ,
0x8b  ,
0xbe  ,
0x35   
)

◆ DEFINE_GUID() [15/19]

DEFINE_GUID ( GUID_COMPARTMENT_SPEECH_OPENCLOSE  ,
0x544d6a63  ,
0xe2e8  ,
0x4752  ,
0xbb  ,
0xd1  ,
0x00  ,
0x09  ,
0x60  ,
0xbc  ,
0xa0  ,
0x83   
)

◆ DEFINE_GUID() [16/19]

DEFINE_GUID ( GUID_COMPARTMENT_SPEECH_GLOBALSTATE  ,
0x2a54fe8e  ,
0x0d08  ,
0x460c  ,
0xa7  ,
0x5d  ,
0x87  ,
0x03  ,
0x5f  ,
0xf4  ,
0x36  ,
0xc5   
)

◆ DEFINE_GUID() [17/19]

DEFINE_GUID ( GUID_COMPARTMENT_PERSISTMENUENABLED  ,
0x575f3783  ,
0x70c8  ,
0x47c8  ,
0xae  ,
0x5d  ,
0x91  ,
0xa0  ,
0x1a  ,
0x1f  ,
0x75  ,
0x92   
)

◆ DEFINE_GUID() [18/19]

DEFINE_GUID ( GUID_COMPARTMENT_EMPTYCONTEXT  ,
0xd7487dbf  ,
0x804e  ,
0x41c5  ,
0x89  ,
0x4d  ,
0xad  ,
0x96  ,
0xfd  ,
0x4e  ,
0xea  ,
0x13   
)

◆ DEFINE_GUID() [19/19]

DEFINE_GUID ( GUID_COMPARTMENT_TIPUISTATUS  ,
0x148ca3ec  ,
0x0366  ,
0x401c  ,
0x8d  ,
0x75  ,
0xed  ,
0x97  ,
0x8d  ,
0x85  ,
0xfb  ,
0xc9   
)

◆ EditSession_AddRef()

static ULONG WINAPI EditSession_AddRef ( ITfEditSession iface)
static

Definition at line 2010 of file inputprocessor.c.

2011 {
2013  return InterlockedIncrement(&This->refCount);
2014 }
static EditSession * impl_from_ITfEditSession(ITfEditSession *iface)
#define InterlockedIncrement
Definition: armddk.h:53

◆ EditSession_Constructor()

static HRESULT EditSession_Constructor ( ITfEditSession **  ppOut)
static

Definition at line 2131 of file inputprocessor.c.

2132 {
2133  EditSession *This;
2134 
2135  *ppOut = NULL;
2137  if (This == NULL)
2138  return E_OUTOFMEMORY;
2139 
2140  This->ITfEditSession_iface.lpVtbl = &EditSession_EditSessionVtbl;
2141  This->refCount = 1;
2142 
2143  *ppOut = &This->ITfEditSession_iface;
2144  return S_OK;
2145 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static const ITfEditSessionVtbl EditSession_EditSessionVtbl
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by test_TStoApplicationText().

◆ EditSession_Destructor()

static void EditSession_Destructor ( EditSession This)
static

Definition at line 1987 of file inputprocessor.c.

1988 {
1990 }
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by EditSession_Release().

◆ EditSession_DoEditSession()

static HRESULT WINAPI EditSession_DoEditSession ( ITfEditSession iface,
TfEditCookie  ec 
)
static

Definition at line 2045 of file inputprocessor.c.

2047 {
2048  ITfContext *cxt;
2049  ITfDocumentMgr *dm;
2050  ITfRange *range;
2051  TF_SELECTION selection;
2052  ULONG fetched;
2053  HRESULT hr;
2054 
2055  sink_fire_ok(&test_DoEditSession,"EditSession_DoEditSession");
2056  sink_check_ok(&test_ACP_RequestLock,"RequestLock");
2057 
2058  ITfThreadMgr_GetFocus(g_tm, &dm);
2059  ITfDocumentMgr_GetTop(dm,&cxt);
2060 
2061  hr = ITfContext_GetStart(cxt,ec,NULL);
2062  ok(hr == E_INVALIDARG,"Unexpected return code %x\n",hr);
2063 
2064  range = (ITfRange*)0xdeaddead;
2065  hr = ITfContext_GetStart(cxt,0xdeadcafe,&range);
2066  ok(hr == TF_E_NOLOCK,"Unexpected return code %x\n",hr);
2067  ok(range == NULL,"Range not set to NULL\n");
2068 
2069  hr = ITfContext_GetStart(cxt,ec,&range);
2070  ok(SUCCEEDED(hr),"Unexpected return code %x\n",hr);
2071  ok(range != NULL,"Range set to NULL\n");
2072 
2073  ITfRange_Release(range);
2074 
2075  hr = ITfContext_GetEnd(cxt,ec,NULL);
2076  ok(hr == E_INVALIDARG,"Unexpected return code %x\n",hr);
2077 
2078  range = (ITfRange*)0xdeaddead;
2079  hr = ITfContext_GetEnd(cxt,0xdeadcafe,&range);
2080  ok(hr == TF_E_NOLOCK,"Unexpected return code %x\n",hr);
2081  ok(range == NULL,"Range not set to NULL\n");
2082 
2084  hr = ITfContext_GetEnd(cxt,ec,&range);
2085  ok(SUCCEEDED(hr),"Unexpected return code %x\n",hr);
2086  ok(range != NULL,"Range set to NULL\n");
2087  sink_check_ok(&test_ACP_GetEndACP,"GetEndACP");
2088 
2089  ITfRange_Release(range);
2090 
2091  selection.range = NULL;
2093  hr = ITfContext_GetSelection(cxt, ec, TF_DEFAULT_SELECTION, 1, &selection, &fetched);
2094  ok(SUCCEEDED(hr),"ITfContext_GetSelection failed\n");
2095  ok(fetched == 1,"fetched incorrect\n");
2096  ok(selection.range != NULL,"NULL range\n");
2097  sink_check_ok(&test_ACP_GetSelection,"GetSelection");
2098  ITfRange_Release(selection.range);
2099 
2100  test_InsertAtSelection(ec, cxt);
2101 
2103  hr = ITfContext_GetEnd(cxt,ec,&range);
2104  ok(SUCCEEDED(hr),"Unexpected return code %x\n",hr);
2105  ok(range != NULL,"Range set to NULL\n");
2106  sink_check_ok(&test_ACP_GetEndACP,"GetEndACP");
2107 
2108  selection.range = range;
2109  selection.style.ase = TF_AE_NONE;
2110  selection.style.fInterimChar = FALSE;
2112  hr = ITfContext_SetSelection(cxt, ec, 1, &selection);
2113  ok(SUCCEEDED(hr),"ITfContext_SetSelection failed\n");
2114  sink_check_ok(&test_ACP_SetSelection,"SetSelection");
2115  ITfRange_Release(range);
2116 
2117  ITfContext_Release(cxt);
2118  ITfDocumentMgr_Release(dm);
2119  return 0xdeadcafe;
2120 }
HRESULT hr
Definition: shlfolder.c:183
static INT test_ACP_SetSelection
int selection
Definition: ctm.c:92
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static void test_InsertAtSelection(TfEditCookie ec, ITfContext *cxt)
#define SINK_EXPECTED
static ITfThreadMgr * g_tm
LONG HRESULT
Definition: typedefs.h:77
static INT test_ACP_GetEndACP
#define sink_fire_ok(a, b)
static INT test_ACP_GetSelection
static INT test_DoEditSession
GLenum GLint * range
Definition: glext.h:7539
static INT test_ACP_RequestLock
#define ok(value,...)
Definition: atltest.h:57
#define sink_check_ok(a, b)
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ EditSession_QueryInterface()

static HRESULT WINAPI EditSession_QueryInterface ( ITfEditSession iface,
REFIID  iid,
LPVOID ppvOut 
)
static

Definition at line 1992 of file inputprocessor.c.

1993 {
1994  *ppvOut = NULL;
1995 
1996  if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfEditSession))
1997  {
1998  *ppvOut = iface;
1999  }
2000 
2001  if (*ppvOut)
2002  {
2003  ITfEditSession_AddRef(iface);
2004  return S_OK;
2005  }
2006 
2007  return E_NOINTERFACE;
2008 }
#define E_NOINTERFACE
Definition: winerror.h:2364
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ EditSession_Release()

static ULONG WINAPI EditSession_Release ( ITfEditSession iface)
static

Definition at line 2016 of file inputprocessor.c.

2017 {
2019  ULONG ret;
2020 
2021  ret = InterlockedDecrement(&This->refCount);
2022  if (ret == 0)
2024  return ret;
2025 }
static EditSession * impl_from_ITfEditSession(ITfEditSession *iface)
static void EditSession_Destructor(EditSession *This)
int ret
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1

◆ enum_compartments()

static void enum_compartments ( ITfCompartmentMgr cmpmgr,
REFGUID  present,
REFGUID  absent 
)
static

Definition at line 2215 of file inputprocessor.c.

2216 {
2217  BOOL found,found2;
2218  IEnumGUID *ppEnum;
2219  found = FALSE;
2220  found2 = FALSE;
2221  if (SUCCEEDED(ITfCompartmentMgr_EnumCompartments(cmpmgr, &ppEnum)))
2222  {
2223  ULONG fetched;
2224  GUID g;
2225  while (IEnumGUID_Next(ppEnum, 1, &g, &fetched) == S_OK)
2226  {
2227  WCHAR str[50];
2228  CHAR strA[50];
2230  WideCharToMultiByte(CP_ACP,0,str,-1,strA,sizeof(strA),0,0);
2231  trace("found %s\n",strA);
2232  if (present && IsEqualGUID(present,&g))
2233  found = TRUE;
2234  if (absent && IsEqualGUID(absent, &g))
2235  found2 = TRUE;
2236  }
2237  IEnumGUID_Release(ppEnum);
2238  }
2239  if (present)
2240  ok(found,"Did not find compartment\n");
2241  if (absent)
2242  ok(!found2,"Found compartment that should be absent\n");
2243 }
char strA[12]
Definition: clipboard.c:2028
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
unsigned int BOOL
Definition: ntddk_ex.h:94
const WCHAR * str
GLboolean GLboolean g
Definition: glext.h:6204
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_Compartments().

◆ expected_count()

◆ impl_from_IClassFactory()

static ClassFactory* impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 839 of file inputprocessor.c.

840 {
841  return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
842 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by ClassFactory_AddRef(), ClassFactory_CreateInstance(), and ClassFactory_Release().

◆ impl_from_ITextStoreACP()

static TextStoreACP* impl_from_ITextStoreACP ( ITextStoreACP iface)
inlinestatic

Definition at line 185 of file inputprocessor.c.

186 {
187  return CONTAINING_RECORD(iface, TextStoreACP, ITextStoreACP_iface);
188 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by TextStoreACP_AddRef(), and TextStoreACP_Release().

◆ impl_from_ITfEditSession()

static EditSession* impl_from_ITfEditSession ( ITfEditSession iface)
inlinestatic

Definition at line 1982 of file inputprocessor.c.

1983 {
1984  return CONTAINING_RECORD(iface, EditSession, ITfEditSession_iface);
1985 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by EditSession_AddRef(), and EditSession_Release().

◆ impl_from_ITfKeyEventSink()

static KeyEventSink* impl_from_ITfKeyEventSink ( ITfKeyEventSink iface)
inlinestatic

Definition at line 1327 of file inputprocessor.c.

1328 {
1329  return CONTAINING_RECORD(iface, KeyEventSink, ITfKeyEventSink_iface);
1330 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by KeyEventSink_AddRef(), and KeyEventSink_Release().

◆ impl_from_ITfTextEditSink()

static TextEditSink* impl_from_ITfTextEditSink ( ITfTextEditSink iface)
inlinestatic

Definition at line 1588 of file inputprocessor.c.

1589 {
1590  return CONTAINING_RECORD(iface, TextEditSink, ITfTextEditSink_iface);
1591 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by TextEditSink_AddRef(), and TextEditSink_Release().

◆ impl_from_ITfTextInputProcessor()

static TextService* impl_from_ITfTextInputProcessor ( ITfTextInputProcessor iface)
inlinestatic

Definition at line 850 of file inputprocessor.c.

851 {
852  return CONTAINING_RECORD(iface, TextService, ITfTextInputProcessor_iface);
853 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by TextService_AddRef(), and TextService_Release().

◆ impl_from_ITfThreadMgrEventSink()

static ThreadMgrEventSink* impl_from_ITfThreadMgrEventSink ( ITfThreadMgrEventSink iface)
inlinestatic

Definition at line 482 of file inputprocessor.c.

483 {
484  return CONTAINING_RECORD(iface, ThreadMgrEventSink, ITfThreadMgrEventSink_iface);
485 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by ThreadMgrEventSink_AddRef(), and ThreadMgrEventSink_Release().

◆ initialize()

static HRESULT initialize ( void  )
static

Definition at line 1053 of file inputprocessor.c.

1054 {
1055  HRESULT hr;
1056  HKEY hkey;
1057 
1058  CoInitialize(NULL);
1059 
1060  if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\CTF\\TIP", 0,
1061  KEY_READ|KEY_WRITE, &hkey) != ERROR_SUCCESS)
1062  {
1063  skip("Not enough permission to register input processor\n");
1064  return E_FAIL;
1065  }
1066  RegCloseKey(hkey);
1067 
1069  CLSCTX_INPROC_SERVER, &IID_ITfInputProcessorProfiles, (void**)&g_ipp);
1070  if (SUCCEEDED(hr))
1072  CLSCTX_INPROC_SERVER, &IID_ITfCategoryMgr, (void**)&g_cm);
1073  if (SUCCEEDED(hr))
1075  CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (void**)&g_tm);
1076  return hr;
1077 }
static ITfCategoryMgr * g_cm
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
#define E_FAIL
Definition: ddrawi.h:102
EXTERN_C const CLSID CLSID_TF_CategoryMgr
Definition: msctf.idl:47
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles
Definition: msctf.idl:45
#define KEY_WRITE
Definition: nt_native.h:1031
static ITfThreadMgr * g_tm
LONG HRESULT
Definition: typedefs.h:77
EXTERN_C const CLSID CLSID_TF_ThreadMgr
Definition: msctf.idl:44
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define skip(...)
Definition: atltest.h:64
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
static ITfInputProcessorProfiles * g_ipp
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by START_TEST().

◆ KeyEventSink_AddRef()

static ULONG WINAPI KeyEventSink_AddRef ( ITfKeyEventSink iface)
static

Definition at line 1355 of file inputprocessor.c.

1356 {
1358  return InterlockedIncrement(&This->refCount);
1359 }
static KeyEventSink * impl_from_ITfKeyEventSink(ITfKeyEventSink *iface)
#define InterlockedIncrement
Definition: armddk.h:53

◆ KeyEventSink_Constructor()

static HRESULT KeyEventSink_Constructor ( ITfKeyEventSink **  ppOut)
static

Definition at line 1428 of file inputprocessor.c.

1429 {
1430  KeyEventSink *This;
1431 
1433  if (This == NULL)
1434  return E_OUTOFMEMORY;
1435 
1436  This->ITfKeyEventSink_iface.lpVtbl = &KeyEventSink_KeyEventSinkVtbl;
1437  This->refCount = 1;
1438 
1439  *ppOut = &This->ITfKeyEventSink_iface;
1440  return S_OK;
1441 }
static const ITfKeyEventSinkVtbl KeyEventSink_KeyEventSinkVtbl
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by test_KeystrokeMgr().

◆ KeyEventSink_Destructor()

static void KeyEventSink_Destructor ( KeyEventSink This)
static

Definition at line 1332 of file inputprocessor.c.

1333 {
1335 }
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by KeyEventSink_Release().

◆ KeyEventSink_OnKeyDown()

static HRESULT WINAPI KeyEventSink_OnKeyDown ( ITfKeyEventSink iface,
ITfContext pic,
WPARAM  wParam,
LPARAM  lParam,
BOOL pfEaten 
)
static

Definition at line 1393 of file inputprocessor.c.

1395 {
1396  trace("\n");
1397  return S_OK;
1398 }
#define trace
Definition: atltest.h:70
#define S_OK
Definition: intsafe.h:59

◆ KeyEventSink_OnKeyUp()

static HRESULT WINAPI KeyEventSink_OnKeyUp ( ITfKeyEventSink iface,
ITfContext pic,
WPARAM  wParam,
LPARAM  lParam,
BOOL pfEaten 
)
static

Definition at line 1400 of file inputprocessor.c.

1402 {
1403  trace("\n");
1404  return S_OK;
1405 }
#define trace
Definition: atltest.h:70
#define S_OK
Definition: intsafe.h:59

◆ KeyEventSink_OnPreservedKey()

static HRESULT WINAPI KeyEventSink_OnPreservedKey ( ITfKeyEventSink iface,
ITfContext pic,
REFGUID  rguid,
BOOL pfEaten 
)
static

Definition at line 1407 of file inputprocessor.c.

1409 {
1410  trace("\n");
1411  return S_OK;
1412 }
#define trace
Definition: atltest.h:70
#define S_OK
Definition: intsafe.h:59

◆ KeyEventSink_OnSetFocus()

static HRESULT WINAPI KeyEventSink_OnSetFocus ( ITfKeyEventSink iface,
BOOL  fForeground 
)
static

Definition at line 1372 of file inputprocessor.c.

1374 {
1375  sink_fire_ok(&test_KEV_OnSetFocus,"KeyEventSink_OnSetFocus");
1376  return S_OK;
1377 }
static INT test_KEV_OnSetFocus
#define sink_fire_ok(a, b)
#define S_OK
Definition: intsafe.h:59

◆ KeyEventSink_OnTestKeyDown()

static HRESULT WINAPI KeyEventSink_OnTestKeyDown ( ITfKeyEventSink iface,
ITfContext pic,
WPARAM  wParam,
LPARAM  lParam,
BOOL pfEaten 
)
static

Definition at line 1379 of file inputprocessor.c.

1381 {
1382  trace("\n");
1383  return S_OK;
1384 }
#define trace
Definition: atltest.h:70
#define S_OK
Definition: intsafe.h:59

◆ KeyEventSink_OnTestKeyUp()

static HRESULT WINAPI KeyEventSink_OnTestKeyUp ( ITfKeyEventSink iface,
ITfContext pic,
WPARAM  wParam,
LPARAM  lParam,
BOOL pfEaten 
)
static

Definition at line 1386 of file inputprocessor.c.

1388 {
1389  trace("\n");
1390  return S_OK;
1391 }
#define trace
Definition: atltest.h:70
#define S_OK
Definition: intsafe.h:59

◆ KeyEventSink_QueryInterface()

static HRESULT WINAPI KeyEventSink_QueryInterface ( ITfKeyEventSink iface,
REFIID  iid,
LPVOID ppvOut 
)
static

Definition at line 1337 of file inputprocessor.c.

1338 {
1339  *ppvOut = NULL;
1340 
1341  if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfKeyEventSink))
1342  {
1343  *ppvOut = iface;
1344  }
1345 
1346  if (*ppvOut)
1347  {
1348  ITfKeyEventSink_AddRef(iface);
1349  return S_OK;
1350  }
1351 
1352  return E_NOINTERFACE;
1353 }
#define E_NOINTERFACE
Definition: winerror.h:2364
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ KeyEventSink_Release()

static ULONG WINAPI KeyEventSink_Release ( ITfKeyEventSink iface)
static

Definition at line 1361 of file inputprocessor.c.

1362 {
1364  ULONG ret;
1365 
1366  ret = InterlockedDecrement(&This->refCount);
1367  if (ret == 0)
1369  return ret;
1370 }
static KeyEventSink * impl_from_ITfKeyEventSink(ITfKeyEventSink *iface)
static void KeyEventSink_Destructor(KeyEventSink *This)
int ret
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1

◆ processPendingMessages()

static void processPendingMessages ( void  )
static

Definition at line 2295 of file inputprocessor.c.

2296 {
2297  MSG msg;
2298  int diff = 200;
2299  int min_timeout = 100;
2300  DWORD time = GetTickCount() + diff;
2301 
2302  while (diff > 0)
2303  {
2304  if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT)
2305  break;
2306  while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
2307  {
2310  }
2311  diff = time - GetTickCount();
2312  }
2313 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
__u16 time
Definition: mkdosfs.c:366
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define QS_ALLINPUT
Definition: winuser.h:874
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by START_TEST(), and test_AssociateFocus().

◆ ProfileActivationSink_AddRef()

static ULONG WINAPI ProfileActivationSink_AddRef ( ITfInputProcessorProfileActivationSink iface)
static

Definition at line 742 of file inputprocessor.c.

743 {
744  return 2;
745 }

◆ ProfileActivationSink_OnActivated()

static HRESULT WINAPI ProfileActivationSink_OnActivated ( ITfInputProcessorProfileActivationSink iface,
DWORD  dwProfileType,
LANGID  langid,
REFCLSID  clsid,
REFGUID  catid,
REFGUID  guidProfile,
HKL  hkl,
DWORD  dwFlags 
)
static

Definition at line 752 of file inputprocessor.c.

755 {
756  trace("Got OnActivated: {dwProfileType %08x, langid %08x, clsid %s, catid %s, guidProfile %s, %p, dwFlags %08x}\n",
757  dwProfileType, langid, wine_dbgstr_guid(clsid),
759 
760  ok(dwProfileType == TF_PROFILETYPE_INPUTPROCESSOR || dwProfileType == TF_PROFILETYPE_KEYBOARDLAYOUT,
761  "unexpected dwProfileType: 0x%x\n", dwProfileType);
762 
763  if(dwProfileType == TF_PROFILETYPE_INPUTPROCESSOR && IsEqualGUID(&CLSID_FakeService, clsid)){
764  if(dwFlags & TF_IPSINK_FLAG_ACTIVE){
765  ok(test_ShouldActivate, "OnActivated: Activation came unexpectedly\n");
766  }
767 
769  }
770 
771  return S_OK;
772 }
const char * wine_dbgstr_guid(const GUID *guid)
LANGID langid
Definition: msctf.idl:605
static BOOL test_ShouldActivate
GUID catid
Definition: msctf.idl:608
#define trace
Definition: atltest.h:70
GUID guidProfile
Definition: msctf.idl:607
REFCLSID clsid
Definition: msctf.c:82
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:59
HKL hkl
Definition: msctf.idl:611
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static DWORD fake_service_onactivated_flags

◆ ProfileActivationSink_QueryInterface()

static HRESULT WINAPI ProfileActivationSink_QueryInterface ( ITfInputProcessorProfileActivationSink iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 730 of file inputprocessor.c.

732 {
733  if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITfInputProcessorProfileActivationSink, riid)){
734  *ppvObject = iface;
735  return S_OK;
736  }
737 
738  *ppvObject = NULL;
739  return E_NOINTERFACE;
740 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ ProfileActivationSink_Release()

static ULONG WINAPI ProfileActivationSink_Release ( ITfInputProcessorProfileActivationSink iface)
static

Definition at line 747 of file inputprocessor.c.

748 {
749  return 1;
750 }

◆ RegisterTextService()

static HRESULT RegisterTextService ( REFCLSID  rclsid)
static

Definition at line 1019 of file inputprocessor.c.

1020 {
1022  return CoRegisterClassObject(rclsid, (IUnknown*) cf, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &regid);
1023 }
static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
static HRESULT TextService_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2897
static DWORD regid

Referenced by test_Register().

◆ START_TEST()

START_TEST ( inputprocessor  )

Definition at line 2561 of file inputprocessor.c.

2562 {
2563  if (SUCCEEDED(initialize()))
2564  {
2565  test_Register();
2567  Sleep(2000); /* Win7 needs some time before the registrations become active */
2571  test_Enable();
2573  test_Activate();
2576  test_TfGuidAtom();
2577  test_ClientId();
2582  test_endSession();
2584  test_Disable();
2588  test_Unregister();
2589  test_profile_mgr();
2591 
2592  ITextStoreACPSink_Release(ACPSink);
2593  ITfDocumentMgr_Release(g_dm);
2594  }
2595  else
2596  skip("Unable to create InputProcessor\n");
2597  cleanup();
2598 }
static void processPendingMessages(void)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
static void test_ThreadMgrUnadviseSinks(void)
static void test_EnumInputProcessorInfo(void)
static void test_RegisterCategory(void)
static void test_DocumentMgrUnadviseSinks(void)
static void test_EnumLanguageProfiles(void)
static ITextStoreACPSink * ACPSink
static void test_TfGuidAtom(void)
static void test_Disable(void)
static void test_Enable(void)
static void test_ClientId(void)
static void cleanup(void)
static void test_TStoApplicationText(void)
static void test_Register(void)
static void test_endSession(void)
static void test_Unregister(void)
static void test_Compartments(void)
static void test_MultiThreadApartment(void)
static void test_FindClosestCategory(void)
static void test_KeystrokeMgr(void)
static void test_UnregisterCategory(void)
static void test_profile_mgr(void)
static void test_startSession(void)
#define skip(...)
Definition: atltest.h:64
static HRESULT initialize(void)
static void test_Activate(void)
static void test_ThreadMgrAdviseSinks(void)
static void test_AssociateFocus(void)
static void test_DocumentMgrAdviseSinks(void)
static ITfDocumentMgr * g_dm
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ test_Activate()

static void test_Activate ( void  )
static

Definition at line 1500 of file inputprocessor.c.

1501 {
1502  HRESULT hr;
1503 
1504  test_ShouldActivate = TRUE; /* Win7 */
1505  hr = ITfInputProcessorProfiles_ActivateLanguageProfile(g_ipp,&CLSID_FakeService,gLangid,&CLSID_FakeService);
1506  ok(SUCCEEDED(hr),"Failed to Activate text service\n");
1508 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
static BOOL test_ShouldActivate
LONG HRESULT
Definition: typedefs.h:77
static LANGID gLangid
#define ok(value,...)
Definition: atltest.h:57
static ITfInputProcessorProfiles * g_ipp
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_AssociateFocus()

static void test_AssociateFocus ( void  )
static

Definition at line 2315 of file inputprocessor.c.

2316 {
2317  ITfDocumentMgr *dm1, *dm2, *olddm, *dmcheck, *dmorig;
2318  HWND wnd1, wnd2, wnd3;
2319  HRESULT hr;
2320 
2321  ITfThreadMgr_GetFocus(g_tm, &dmorig);
2323  test_PrevFocus = dmorig;
2324  test_OnSetFocus = SINK_OPTIONAL; /* Doesn't always fire on Win7 */
2326  hr = ITfThreadMgr_SetFocus(g_tm,NULL);
2327  ok(SUCCEEDED(hr),"ITfThreadMgr_SetFocus failed\n");
2328  sink_check_ok(&test_OnSetFocus,"OnSetFocus");
2330  ITfDocumentMgr_Release(dmorig);
2331 
2332  hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&dm1);
2333  ok(SUCCEEDED(hr),"CreateDocumentMgr failed\n");
2334 
2335  hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&dm2);
2336  ok(SUCCEEDED(hr),"CreateDocumentMgr failed\n");
2337 
2338  wnd1 = CreateWindowA("edit",NULL,WS_POPUP,0,0,200,60,NULL,NULL,NULL,NULL);
2339  ok(wnd1!=NULL,"Unable to create window 1\n");
2340  wnd2 = CreateWindowA("edit",NULL,WS_POPUP,0,65,200,60,NULL,NULL,NULL,NULL);
2341  ok(wnd2!=NULL,"Unable to create window 2\n");
2342  wnd3 = CreateWindowA("edit",NULL,WS_POPUP,0,130,200,60,NULL,NULL,NULL,NULL);
2343  ok(wnd3!=NULL,"Unable to create window 3\n");
2344 
2346 
2347  test_OnInitDocumentMgr = SINK_OPTIONAL; /* Vista and greater */
2348  test_OnPushContext = SINK_OPTIONAL; /* Vista and greater */
2349  test_OnSetFocus = SINK_OPTIONAL; /* Win7 */
2350  test_PrevFocus = NULL;
2352 
2353  ShowWindow(wnd1,SW_SHOWNORMAL);
2355  SetFocus(wnd1);
2356  sink_check_ok(&test_OnInitDocumentMgr,"OnInitDocumentMgr");
2357  sink_check_ok(&test_OnPushContext,"OnPushContext");
2358 
2359  test_OnSetFocus = SINK_OPTIONAL; /* Vista and greater */
2360  test_ACP_RequestLock = SINK_OPTIONAL; /* Win7 x64 */
2361  test_ACP_GetSelection = SINK_OPTIONAL; /* Win7 x64 */
2362  ITfThreadMgr_GetFocus(g_tm, &test_PrevFocus);
2363  test_CurrentFocus = FOCUS_IGNORE; /* This is a default system context */
2365  sink_check_ok(&test_OnSetFocus,"OnSetFocus");
2368 
2369  test_CurrentFocus = dm1;
2373  hr = ITfThreadMgr_AssociateFocus(g_tm,wnd1,dm1,&olddm);
2374  ok(SUCCEEDED(hr),"AssociateFocus failed\n");
2375  sink_check_ok(&test_OnSetFocus,"OnSetFocus");
2377 
2379 
2380  ITfThreadMgr_GetFocus(g_tm, &dmcheck);
2381  ok(dmcheck == dm1 || broken(dmcheck == dmorig /* Win7+ */), "Expected DocumentMgr not focused\n");
2382  ITfDocumentMgr_Release(dmcheck);
2383 
2384  /* We need to explicitly set focus on Win7+ */
2385  test_CurrentFocus = dm1;
2387  test_OnSetFocus = SINK_OPTIONAL; /* Doesn't always fire on Win7+ */
2388  ITfThreadMgr_SetFocus(g_tm, dm1);
2389  sink_check_ok(&test_OnSetFocus, "OnSetFocus");
2390 
2391  hr = ITfThreadMgr_AssociateFocus(g_tm,wnd2,dm2,&olddm);
2392  ok(SUCCEEDED(hr),"AssociateFocus failed\n");
2394  ITfThreadMgr_GetFocus(g_tm, &dmcheck);
2395  ok(dmcheck == dm1, "Expected DocumentMgr not focused\n");
2396  ITfDocumentMgr_Release(dmcheck);
2397 
2398  hr = ITfThreadMgr_AssociateFocus(g_tm,wnd3,dm2,&olddm);
2399  ok(SUCCEEDED(hr),"AssociateFocus failed\n");
2401  ITfThreadMgr_GetFocus(g_tm, &dmcheck);
2402  ok(dmcheck == dm1, "Expected DocumentMgr not focused\n");
2403  ITfDocumentMgr_Release(dmcheck);
2404 
2408  test_ShouldDeactivate = TRUE; /* win 8/10 */
2409  ShowWindow(wnd2,SW_SHOWNORMAL);
2410  SetFocus(wnd2);
2411  sink_check_saved(&test_OnSetFocus,dm1,dm2,"OnSetFocus");
2412  test_CurrentFocus = FOCUS_IGNORE; /* occasional wine race */
2413  test_PrevFocus = FOCUS_IGNORE; /* occasional wine race */
2414  test_OnSetFocus = SINK_IGNORE; /* occasional wine race */
2417 
2418  ShowWindow(wnd3,SW_SHOWNORMAL);
2419  SetFocus(wnd3);
2421 
2425  SetFocus(wnd1);
2427  sink_check_saved(&test_OnSetFocus,dm2,dm1,"OnSetFocus");
2428 
2429  hr = ITfThreadMgr_AssociateFocus(g_tm,wnd3,NULL,&olddm);
2430  ok(SUCCEEDED(hr),"AssociateFocus failed\n");
2431  ok(olddm == dm2, "incorrect old DocumentMgr returned\n");
2432  ITfDocumentMgr_Release(olddm);
2433 
2434  test_CurrentFocus = dmorig;
2435  test_PrevFocus = dm1;
2436  test_OnSetFocus = SINK_OPTIONAL; /* Doesn't always fire on Win7+ */
2438  ITfThreadMgr_SetFocus(g_tm,dmorig);
2439  sink_check_ok(&test_OnSetFocus,"OnSetFocus");
2440 
2444  SetFocus(wnd3);
2446  sink_check_saved(&test_OnSetFocus,dmorig,FOCUS_IGNORE,"OnSetFocus"); /* CurrentFocus NULL on XP, system default on Vista */
2447 
2448  hr = ITfThreadMgr_AssociateFocus(g_tm,wnd2,NULL,&olddm);
2449  ok(SUCCEEDED(hr),"AssociateFocus failed\n");
2450  ok(olddm == dm2, "incorrect old DocumentMgr returned\n");
2451  ITfDocumentMgr_Release(olddm);
2452  hr = ITfThreadMgr_AssociateFocus(g_tm,wnd1,NULL,&olddm);
2453  ok(SUCCEEDED(hr),"AssociateFocus failed\n");
2454  ok(olddm == dm1, "incorrect old DocumentMgr returned\n");
2455  ITfDocumentMgr_Release(olddm);
2456 
2457  test_OnSetFocus = SINK_IGNORE; /* OnSetFocus fires a couple of times on Win7 */
2460  SetFocus(wnd2);
2462  SetFocus(wnd1);
2465 
2466  ITfDocumentMgr_Release(dm1);
2467  ITfDocumentMgr_Release(dm2);
2468 
2469  test_CurrentFocus = dmorig;
2473  ITfThreadMgr_SetFocus(g_tm,dmorig);
2474  sink_check_ok(&test_OnSetFocus,"OnSetFocus");
2475 
2476  test_OnSetFocus = SINK_IGNORE; /* OnSetFocus fires a couple of times on Win7 */
2479  DestroyWindow(wnd1);
2480  DestroyWindow(wnd2);
2481  test_OnPopContext = SINK_OPTIONAL; /* Vista and greater */
2482  test_OnSetFocus = SINK_OPTIONAL; /* Vista and greater */
2483  ITfThreadMgr_GetFocus(g_tm, &test_PrevFocus);
2485  test_ShouldDeactivate = TRUE; /* Win7 */
2486  DestroyWindow(wnd3);
2488  sink_check_ok(&test_OnSetFocus,"OnSetFocus");
2489  sink_check_ok(&test_OnPopContext,"OnPopContext");
2490 }
static void processPendingMessages(void)
#define TRUE
Definition: types.h:120
static INT test_OnPopContext
HRESULT hr
Definition: shlfolder.c:183
HWND WINAPI SetFocus(_In_opt_ HWND)
#define SINK_UNEXPECTED
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
static BOOL test_ShouldDeactivate
#define SINK_SAVE
#define SINK_OPTIONAL
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
static INT test_OnPushContext
smooth NULL
Definition: ftsmooth.c:416
static ITfDocumentMgr * test_CurrentFocus
#define sink_check_saved(s, p, c, n)
static ITfThreadMgr * g_tm
static INT test_ACP_GetStatus
static INT test_OnInitDocumentMgr
LONG HRESULT
Definition: typedefs.h:77
static INT test_OnSetFocus
static INT test_ACP_GetSelection
#define FOCUS_IGNORE
#define broken(x)
Definition: _sntprintf.h:21
#define SW_SHOWNORMAL
Definition: winuser.h:764
static INT test_ACP_RequestLock
static ITfDocumentMgr * test_PrevFocus
#define ok(value,...)
Definition: atltest.h:57
#define SINK_IGNORE
#define WS_POPUP
Definition: pedump.c:616
#define sink_check_ok(a, b)
#define FOCUS_SAVE
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_ClientId()

static void test_ClientId ( void  )
static

Definition at line 1943 of file inputprocessor.c.

1944 {
1945  ITfClientId *pcid;
1946  TfClientId id1,id2;
1947  HRESULT hr;
1948  GUID g2;
1949 
1950  hr = ITfThreadMgr_QueryInterface(g_tm, &IID_ITfClientId, (LPVOID*)&pcid);
1951  ok(SUCCEEDED(hr),"Unable to acquire ITfClientId interface\n");
1952 
1953  CoCreateGuid(&g2);
1954 
1955  hr = ITfClientId_GetClientId(pcid,&GUID_NULL,&id1);
1956  ok(SUCCEEDED(hr),"GetClientId failed\n");
1957  hr = ITfClientId_GetClientId(pcid,&GUID_NULL,&id2);
1958  ok(SUCCEEDED(hr),"GetClientId failed\n");
1959  ok(id1==id2,"Id's for GUID_NULL do not match\n");
1960  hr = ITfClientId_GetClientId(pcid,&CLSID_FakeService,&id2);
1961  ok(SUCCEEDED(hr),"GetClientId failed\n");
1962  ok(id2!=id1,"Id matches GUID_NULL\n");
1963  ok(id2==tid,"Id for CLSID_FakeService not matching tid\n");
1964  ok(id2!=cid,"Id for CLSID_FakeService matching cid\n");
1965  hr = ITfClientId_GetClientId(pcid,&g2,&id2);
1966  ok(SUCCEEDED(hr),"GetClientId failed\n");
1967  ok(id2!=id1,"Id matches GUID_NULL\n");
1968  ok(id2!=tid,"Id for random guid matching tid\n");
1969  ok(id2!=cid,"Id for random guid matching cid\n");
1970  ITfClientId_Release(pcid);
1971 }
HRESULT hr
Definition: shlfolder.c:183
static TfClientId cid
static ITfThreadMgr * g_tm
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2206
#define GUID_NULL
Definition: ks.h:106
#define ok(value,...)
Definition: atltest.h:57
DWORD TfClientId
Definition: msctf.idl:68
static TfClientId tid
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_Compartments()

static void test_Compartments ( void  )
static

Definition at line 2245 of file inputprocessor.c.

2246 {
2247  ITfContext *cxt;
2248  ITfDocumentMgr *dm;
2249  ITfCompartmentMgr *cmpmgr;
2251  HRESULT hr;
2252 
2253  ITfThreadMgr_GetFocus(g_tm, &dm);
2254  ITfDocumentMgr_GetTop(dm,&cxt);
2255 
2256  /* Global */
2257  hr = ITfThreadMgr_GetGlobalCompartment(g_tm, &cmpmgr);
2258  ok(SUCCEEDED(hr),"GetGlobalCompartment failed\n");
2259  hr = ITfCompartmentMgr_GetCompartment(cmpmgr, &GUID_COMPARTMENT_SPEECH_OPENCLOSE, &cmp);
2260  ok(SUCCEEDED(hr),"GetCompartment failed\n");
2261  ITfCompartment_Release(cmp);
2263  ITfCompartmentMgr_Release(cmpmgr);
2264 
2265  /* Thread */
2266  hr = ITfThreadMgr_QueryInterface(g_tm, &IID_ITfCompartmentMgr, (LPVOID*)&cmpmgr);
2267  ok(SUCCEEDED(hr),"ThreadMgr QI for IID_ITfCompartmentMgr failed\n");
2268  hr = ITfCompartmentMgr_GetCompartment(cmpmgr, &CLSID_FakeService, &cmp);
2269  ok(SUCCEEDED(hr),"GetCompartment failed\n");
2270  enum_compartments(cmpmgr,&CLSID_FakeService,&GUID_COMPARTMENT_SPEECH_OPENCLOSE);
2271  ITfCompartmentMgr_ClearCompartment(cmpmgr,tid,&CLSID_FakeService);
2272  enum_compartments(cmpmgr,NULL,&CLSID_FakeService);
2273  ITfCompartmentMgr_Release(cmpmgr);
2274  ITfCompartment_Release(cmp);
2275 
2276  /* DocumentMgr */
2277  hr = ITfDocumentMgr_QueryInterface(dm, &IID_ITfCompartmentMgr, (LPVOID*)&cmpmgr);
2278  ok(SUCCEEDED(hr),"DocumentMgr QI for IID_ITfCompartmentMgr failed\n");
2279 
2280  hr = ITfCompartmentMgr_GetCompartment(cmpmgr, &GUID_COMPARTMENT_PERSISTMENUENABLED, &cmp);
2281  ok(SUCCEEDED(hr),"GetCompartment failed\n");
2283  ITfCompartmentMgr_Release(cmpmgr);
2284 
2285  /* Context */
2286  hr = ITfContext_QueryInterface(cxt, &IID_ITfCompartmentMgr, (LPVOID*)&cmpmgr);
2287  ok(SUCCEEDED(hr),"Context QI for IID_ITfCompartmentMgr failed\n");
2289  ITfCompartmentMgr_Release(cmpmgr);
2290 
2291  ITfContext_Release(cxt);
2292  ITfDocumentMgr_Release(dm);
2293 }
static void enum_compartments(ITfCompartmentMgr *cmpmgr, REFGUID present, REFGUID absent)
HRESULT hr
Definition: shlfolder.c:183
EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_OPENCLOSE
Definition: msctf.idl:55
#define cmp(status, error)
Definition: error.c:114
smooth NULL
Definition: ftsmooth.c:416
static ITfThreadMgr * g_tm
LONG HRESULT
Definition: typedefs.h:77
EXTERN_C const GUID GUID_COMPARTMENT_PERSISTMENUENABLED
Definition: msctf.idl:57
#define ok(value,...)
Definition: atltest.h:57
static TfClientId tid
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_Disable()

static void test_Disable ( void  )
static

Definition at line 1214 of file inputprocessor.c.

1215 {
1216  HRESULT hr;
1217 
1218  trace("Disabling\n");
1219  hr = ITfInputProcessorProfiles_EnableLanguageProfile(g_ipp,&CLSID_FakeService, gLangid, &CLSID_FakeService, FALSE);
1220  ok(SUCCEEDED(hr),"Failed to disable text service\n");
1221 }
HRESULT hr
Definition: shlfolder.c:183
#define trace
Definition: atltest.h:70
LONG HRESULT
Definition: typedefs.h:77
static LANGID gLangid
#define ok(value,...)
Definition: atltest.h:57
static ITfInputProcessorProfiles * g_ipp
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_DocumentMgrAdviseSinks()

static void test_DocumentMgrAdviseSinks ( void  )
static

Definition at line 1290 of file inputprocessor.c.

1291 {
1292  ITfSource *source;
1293  HRESULT hr;
1294 
1295  hr = ITfDocumentMgr_QueryInterface(g_dm, &IID_ITfSource, (void**)&source);
1296  ok(hr == S_OK,"Failed to get IID_ITfSource for DocumentMgr\n");
1297 
1298  dmSinkCookie = 0;
1299  hr = ITfSource_AdviseSink(source, &IID_ITfTransitoryExtensionSink, (IUnknown*)&TfTransitoryExtensionSink, &dmSinkCookie);
1300  ok(hr == S_OK,"Failed to Advise Sink\n");
1301 
1302  ITfSource_Release(source);
1303 }
HRESULT hr
Definition: shlfolder.c:183
static ITfTransitoryExtensionSink TfTransitoryExtensionSink
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static DWORD dmSinkCookie
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define ok(value,...)
Definition: atltest.h:57
static ITfDocumentMgr * g_dm

Referenced by START_TEST().

◆ test_DocumentMgrUnadviseSinks()

static void test_DocumentMgrUnadviseSinks ( void  )
static

Definition at line 1305 of file inputprocessor.c.

1306 {
1307  ITfSource *source = NULL;
1308  HRESULT hr;
1309 
1310  hr = ITfDocumentMgr_QueryInterface(g_dm, &IID_ITfSource, (void**)&source);
1311  ok(hr == S_OK,"Failed to get IID_ITfSource for DocumentMgr\n");
1312 
1313  hr = ITfSource_UnadviseSink(source, dmSinkCookie);
1314  ok(hr == S_OK,"Failed to unadvise Sink\n");
1315  ITfSource_Release(source);
1316 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static DWORD dmSinkCookie
#define ok(value,...)
Definition: atltest.h:57
static ITfDocumentMgr * g_dm

Referenced by START_TEST().

◆ test_Enable()

static void test_Enable ( void  )
static

Definition at line 1202 of file inputprocessor.c.

1203 {
1204  HRESULT hr;
1205  BOOL enabled = FALSE;
1206 
1207  hr = ITfInputProcessorProfiles_EnableLanguageProfile(g_ipp,&CLSID_FakeService, gLangid, &CLSID_FakeService, TRUE);
1208  ok(SUCCEEDED(hr),"Failed to enable text service\n");
1209  hr = ITfInputProcessorProfiles_IsEnabledLanguageProfile(g_ipp,&CLSID_FakeService, gLangid, &CLSID_FakeService, &enabled);
1210  ok(SUCCEEDED(hr),"Failed to get enabled state\n");
1211  ok(enabled == TRUE,"enabled state incorrect\n");
1212 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG HRESULT
Definition: typedefs.h:77
static LANGID gLangid
#define ok(value,...)
Definition: atltest.h:57
static ITfInputProcessorProfiles * g_ipp
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_endSession()

static void test_endSession ( void  )
static

Definition at line 1891 of file inputprocessor.c.

1892 {
1893  HRESULT hr;
1896  test_PrevFocus = g_dm;
1897  test_OnSetFocus = SINK_OPTIONAL; /* Doesn't fire on Win7 */
1898  hr = ITfThreadMgr_Deactivate(g_tm);
1899  ok(SUCCEEDED(hr),"Failed to Deactivate\n");
1900  sink_check_ok(&test_OnSetFocus,"OnSetFocus");
1902 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define SINK_UNEXPECTED
static BOOL test_ShouldDeactivate
#define SINK_OPTIONAL
smooth NULL
Definition: ftsmooth.c:416
static ITfDocumentMgr * test_CurrentFocus
static ITfThreadMgr * g_tm
LONG HRESULT
Definition: typedefs.h:77
static INT test_OnSetFocus
static ITfDocumentMgr * test_PrevFocus
#define ok(value,...)
Definition: atltest.h:57
#define sink_check_ok(a, b)
static ITfDocumentMgr * g_dm
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_EnumContexts()

static void test_EnumContexts ( ITfDocumentMgr dm,
ITfContext search 
)
static

Definition at line 1511 of file inputprocessor.c.

1512 {
1513  HRESULT hr;
1514  IEnumTfContexts* pEnum;
1515  BOOL found = FALSE;
1516 
1517  hr = ITfDocumentMgr_EnumContexts(dm,&pEnum);
1518  ok(SUCCEEDED(hr),"EnumContexts failed\n");
1519  if (SUCCEEDED(hr))
1520  {
1521  ULONG fetched;
1522  ITfContext *cxt;
1523  while (IEnumTfContexts_Next(pEnum, 1, &cxt, &fetched) == S_OK)
1524  {
1525  if (!search)
1526  found = TRUE;
1527  else if (search == cxt)
1528  found = TRUE;
1529  ITfContext_Release(cxt);
1530  }
1531  IEnumTfContexts_Release(pEnum);
1532  }
1533  if (search)
1534  ok(found,"Did not find proper ITfContext\n");
1535  else
1536  ok(!found,"Found an ITfContext we should should not have\n");
1537 }
static short search(int val, const short *table, int size)
Definition: msg711.c:255
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_startSession().

◆ test_EnumDocumentMgr()

static void test_EnumDocumentMgr ( ITfThreadMgr tm,
ITfDocumentMgr search,
ITfDocumentMgr absent 
)
static

Definition at line 1539 of file inputprocessor.c.

1540 {
1541  HRESULT hr;
1542  IEnumTfDocumentMgrs* pEnum;
1543  BOOL found = FALSE;
1544  BOOL notfound = TRUE;
1545 
1546  hr = ITfThreadMgr_EnumDocumentMgrs(tm,&pEnum);
1547  ok(SUCCEEDED(hr),"EnumDocumentMgrs failed\n");
1548  if (SUCCEEDED(hr))
1549  {
1550  ULONG fetched;
1551  ITfDocumentMgr *dm;
1552  while (IEnumTfDocumentMgrs_Next(pEnum, 1, &dm, &fetched) == S_OK)
1553  {
1554  if (!search)
1555  found = TRUE;
1556  else if (search == dm)
1557  found = TRUE;
1558  if (absent && dm == absent)
1559  notfound = FALSE;
1560  ITfDocumentMgr_Release(dm);
1561  }
1562  IEnumTfDocumentMgrs_Release(pEnum);
1563  }
1564  if (search)
1565  ok(found,"Did not find proper ITfDocumentMgr\n");
1566  else
1567  ok(!found,"Found an ITfDocumentMgr we should should not have\n");
1568  if (absent)
1569  ok(notfound,"Found an ITfDocumentMgr we believe should be absent\n");
1570 }
static short search(int val, const short *table, int size)
Definition: msg711.c:255
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG HRESULT
Definition: typedefs.h:77
Definition: time.h:76
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_startSession().

◆ test_EnumInputProcessorInfo()

static void test_EnumInputProcessorInfo ( void  )
static

Definition at line 1118 of file inputprocessor.c.

1119 {
1120  IEnumGUID *ppEnum;
1121  BOOL found = FALSE;
1122 
1123  if (SUCCEEDED(ITfInputProcessorProfiles_EnumInputProcessorInfo(g_ipp, &ppEnum)))
1124  {
1125  ULONG fetched;
1126  GUID g;
1127  while (IEnumGUID_Next(ppEnum, 1, &g, &fetched) == S_OK)
1128  {
1129  if(IsEqualGUID(&g,&CLSID_FakeService))
1130  found = TRUE;
1131  }
1132  IEnumGUID_Release(ppEnum);
1133  }
1134  ok(found,"Did not find registered text service\n");
1135 }
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
GLboolean GLboolean g
Definition: glext.h:6204
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
unsigned int ULONG
Definition: retypes.h:1
static ITfInputProcessorProfiles * g_ipp
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_EnumLanguageProfiles()

static void test_EnumLanguageProfiles ( void  )
static

Definition at line 1137 of file inputprocessor.c.

1138 {
1139  BOOL found = FALSE;
1140  IEnumTfLanguageProfiles *ppEnum;
1141  HRESULT hr;
1142 
1143  hr = ITfInputProcessorProfiles_EnumLanguageProfiles(g_ipp, gLangid, NULL);
1144  ok(hr == E_INVALIDARG, "EnumLanguageProfiles failed: %x\n", hr);
1145 
1146  if (SUCCEEDED(ITfInputProcessorProfiles_EnumLanguageProfiles(g_ipp,gLangid,&ppEnum)))
1147  {
1149  while (IEnumTfLanguageProfiles_Next(ppEnum,1,&profile,NULL)==S_OK)
1150  {
1151  if (IsEqualGUID(&profile.clsid,&CLSID_FakeService))
1152  {
1153  found = TRUE;
1154  ok(profile.langid == gLangid, "LangId Incorrect\n");
1156  broken(IsEqualGUID(&profile.catid,&GUID_NULL) /* Win8 */), "CatId Incorrect\n");
1157  ok(IsEqualGUID(&profile.guidProfile,&CLSID_FakeService), "guidProfile Incorrect\n");
1158  }
1159  }
1160  IEnumTfLanguageProfiles_Release(ppEnum);
1161  }
1162  ok(found,"Registered text service not found\n");
1163 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
unsigned int BOOL
Definition: ntddk_ex.h:94
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define GUID_NULL
Definition: ks.h:106
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
static LANGID gLangid
#define ok(value,...)
Definition: atltest.h:57
EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD
Definition: msctf.idl:62
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define profile
Definition: kernel32.h:12
static ITfInputProcessorProfiles * g_ipp
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_FindClosestCategory()

static void test_FindClosestCategory ( void  )
static

Definition at line 1183 of file inputprocessor.c.

1184 {
1185  GUID output;
1186  HRESULT hr;
1188 
1189  hr = ITfCategoryMgr_FindClosestCategory(g_cm, &CLSID_FakeService, &output, NULL, 0);
1190  ok(SUCCEEDED(hr),"ITfCategoryMgr_FindClosestCategory failed (%x)\n",hr);
1192 
1193  hr = ITfCategoryMgr_FindClosestCategory(g_cm, &CLSID_FakeService, &output, list, 1);
1194  ok(SUCCEEDED(hr),"ITfCategoryMgr_FindClosestCategory failed (%x)\n",hr);
1195  ok(IsEqualGUID(&output,&GUID_NULL),"Wrong GUID\n");
1196 
1197  hr = ITfCategoryMgr_FindClosestCategory(g_cm, &CLSID_FakeService, &output, list, 3);
1198  ok(SUCCEEDED(hr),"ITfCategoryMgr_FindClosestCategory failed (%x)\n",hr);
1199  ok(IsEqualGUID(&output,&GUID_TFCAT_TIP_KEYBOARD),"Wrong GUID\n");
1200 }
static ITfCategoryMgr * g_cm
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
HRESULT hr
Definition: shlfolder.c:183
EXTERN_C const GUID GUID_TFCAT_TIP_SPEECH
Definition: msctf.idl:63
EXTERN_C const GUID GUID_TFCAT_TIP_HANDWRITING
Definition: msctf.idl:64
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define GUID_NULL
Definition: ks.h:106
Definition: _list.h:228
#define ok(value,...)
Definition: atltest.h:57
EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD
Definition: msctf.idl:62
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
EXTERN_C const GUID GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER
Definition: msctf.idl:65
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_InsertAtSelection()

static void test_InsertAtSelection ( TfEditCookie  ec,
ITfContext cxt 
)
static

Definition at line 2027 of file inputprocessor.c.

2028 {
2029  HRESULT hr;
2030  ITfInsertAtSelection *iis;
2031  ITfRange *range=NULL;
2032  static const WCHAR txt[] = {'H','e','l','l','o',' ','W','o','r','l','d',0};
2033 
2034  hr = ITfContext_QueryInterface(cxt, &IID_ITfInsertAtSelection , (LPVOID*)&iis);
2035  ok(SUCCEEDED(hr),"Failed to get ITfInsertAtSelection interface\n");
2037  hr = ITfInsertAtSelection_InsertTextAtSelection(iis, ec, 0, txt, 11, &range);
2038  ok(SUCCEEDED(hr),"ITfInsertAtSelection_InsertTextAtSelection failed %x\n",hr);
2039  sink_check_ok(&test_ACP_InsertTextAtSelection,"InsertTextAtSelection");
2040  ok(range != NULL,"No range returned\n");
2041  ITfRange_Release(range);
2042  ITfInsertAtSelection_Release(iis);
2043 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
#define SINK_EXPECTED
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLenum GLint * range
Definition: glext.h:7539
static INT test_ACP_InsertTextAtSelection
#define ok(value,...)
Definition: atltest.h:57
#define sink_check_ok(a, b)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by EditSession_DoEditSession().

◆ test_KeystrokeMgr()

static void test_KeystrokeMgr ( void  )
static

Definition at line 1444 of file inputprocessor.c.

1445 {
1446  ITfKeystrokeMgr *keymgr= NULL;
1447  HRESULT hr;
1448  TF_PRESERVEDKEY tfpk;
1449  BOOL preserved;
1451 
1453 
1454  hr = ITfThreadMgr_QueryInterface(g_tm, &IID_ITfKeystrokeMgr, (LPVOID*)&keymgr);
1455  ok(SUCCEEDED(hr),"Failed to get IID_ITfKeystrokeMgr for ThreadMgr\n");
1456 
1457  tfpk.uVKey = 'A';
1458  tfpk.uModifiers = TF_MOD_SHIFT;
1459 
1461  hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,tid,sink,TRUE);
1462  ok(SUCCEEDED(hr),"ITfKeystrokeMgr_AdviseKeyEventSink failed\n");
1463  sink_check_ok(&test_KEV_OnSetFocus,"KeyEventSink_OnSetFocus");
1464  hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,tid,sink,TRUE);
1465  ok(hr == CONNECT_E_ADVISELIMIT,"Wrong return, expected CONNECT_E_ADVISELIMIT\n");
1466  hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,cid,sink,TRUE);
1467  ok(hr == E_INVALIDARG,"Wrong return, expected E_INVALIDARG\n");
1468 
1469  hr =ITfKeystrokeMgr_PreserveKey(keymgr, 0, &CLSID_PreservedKey, &tfpk, NULL, 0);
1470  ok(hr==E_INVALIDARG,"ITfKeystrokeMgr_PreserveKey improperly succeeded\n");
1471 
1472  hr =ITfKeystrokeMgr_PreserveKey(keymgr, tid, &CLSID_PreservedKey, &tfpk, NULL, 0);
1473  ok(SUCCEEDED(hr),"ITfKeystrokeMgr_PreserveKey failed\n");
1474 
1475  hr =ITfKeystrokeMgr_PreserveKey(keymgr, tid, &CLSID_PreservedKey, &tfpk, NULL, 0);
1476  ok(hr == TF_E_ALREADY_EXISTS,"ITfKeystrokeMgr_PreserveKey improperly succeeded\n");
1477 
1478  preserved = FALSE;
1479  hr = ITfKeystrokeMgr_IsPreservedKey(keymgr, &CLSID_PreservedKey, &tfpk, &preserved);
1480  ok(hr == S_OK, "ITfKeystrokeMgr_IsPreservedKey failed\n");
1481  if (hr == S_OK) ok(preserved == TRUE,"misreporting preserved key\n");
1482 
1483  hr = ITfKeystrokeMgr_UnpreserveKey(keymgr, &CLSID_PreservedKey,&tfpk);
1484  ok(SUCCEEDED(hr),"ITfKeystrokeMgr_UnpreserveKey failed\n");
1485 
1486  hr = ITfKeystrokeMgr_IsPreservedKey(keymgr, &CLSID_PreservedKey, &tfpk, &preserved);
1487  ok(hr == S_FALSE, "ITfKeystrokeMgr_IsPreservedKey failed\n");
1488  if (hr == S_FALSE) ok(preserved == FALSE,"misreporting preserved key\n");
1489 
1490  hr = ITfKeystrokeMgr_UnpreserveKey(keymgr, &CLSID_PreservedKey,&tfpk);
1491  ok(hr==CONNECT_E_NOCONNECTION,"ITfKeystrokeMgr_UnpreserveKey improperly succeeded\n");
1492 
1493  hr = ITfKeystrokeMgr_UnadviseKeyEventSink(keymgr,tid);
1494  ok(SUCCEEDED(hr),"ITfKeystrokeMgr_UnadviseKeyEventSink failed\n");
1495 
1496  ITfKeystrokeMgr_Release(keymgr);
1497  ITfKeyEventSink_Release(sink);
1498 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define CONNECT_E_ADVISELIMIT
Definition: olectl.h:252
#define CONNECT_E_NOCONNECTION
Definition: olectl.h:251
static HRESULT KeyEventSink_Constructor(ITfKeyEventSink **ppOut)
static INT test_KEV_OnSetFocus
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
UINT uModifiers
Definition: msctf.idl:129
static TfClientId cid
unsigned int BOOL
Definition: ntddk_ex.h:94
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define SINK_EXPECTED
static ITfThreadMgr * g_tm
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define sink_check_ok(a, b)
static TfClientId tid
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_MultiThreadApartment()

static void test_MultiThreadApartment ( void  )
static

Definition at line 2544 of file inputprocessor.c.

2545 {
2546  DWORD ret;
2547  HANDLE thread;
2548 
2550  ok(thread != NULL, "Failed to create test thread\n");
2551 
2553  ok(ret == WAIT_OBJECT_0, "Failed to wait for thread completion\n");
2554 
2556  ok(ret == 0xdeadcafe, "Thread terminated in an unexpected way\n");
2557 
2559 }
#define CloseHandle
Definition: compat.h:406
static DWORD WINAPI test_MultiThreadApartment_Thread(void *param)
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:540
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
smooth NULL
Definition: ftsmooth.c:416
#define WAIT_OBJECT_0
Definition: winbase.h:387
unsigned long DWORD
Definition: ntddk_ex.h:95
static HANDLE thread
Definition: service.c:33
int ret
#define ok(value,...)
Definition: atltest.h:57
#define INFINITE
Definition: serial.h:102

Referenced by START_TEST().

◆ test_MultiThreadApartment_Thread()

static DWORD WINAPI test_MultiThreadApartment_Thread ( void param)
static

Definition at line 2514 of file inputprocessor.c.

2514  {
2515  ITfThreadMgrEx *thmgr;
2516  ITfSource *source;
2517  DWORD cookie;
2518  HRESULT hr;
2519 
2521  ok(SUCCEEDED(hr), "Failed to initialize multi-threaded apartment\n");
2522 
2523  hr = CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgrEx, (LPVOID *)&thmgr);
2524  ok(SUCCEEDED(hr), "Failed to create ITfThreadMgrEx instance\n");
2525 
2526  hr = ITfThreadMgrEx_QueryInterface(thmgr, &IID_ITfSource, (LPVOID *)&source);
2527  ok(SUCCEEDED(hr), "Failed to query ITfSource interface\n");
2528 
2529  hr = ITfSource_AdviseSink(source, &IID_ITfUIElementSink, (IUnknown*)&TfUIElementSink, &cookie);
2530  ok(hr == REGDB_E_IIDNOTREG /* native */ || hr == E_NOINTERFACE /* wine */,
2531  "Advise ITfUIElementSink should return marshalling failure: %08x\n", hr);
2532 
2533  hr = ITfSource_Release(source);
2534  ok(SUCCEEDED(hr), "Failed to Release source\n");
2535 
2536  hr = ITfThreadMgrEx_Release(thmgr);
2537  ok(SUCCEEDED(hr), "Failed to Release thread manager\n");
2538 
2539  CoUninitialize();
2540 
2541  return 0xdeadcafe;
2542 }
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
#define REGDB_E_IIDNOTREG
Definition: winerror.h:2697
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
EXTERN_C const CLSID CLSID_TF_ThreadMgr
Definition: msctf.idl:44
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define ok(value,...)
Definition: atltest.h:57
Definition: cookie.c:33
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
static ITfUIElementSink TfUIElementSink
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_MultiThreadApartment().

◆ test_profile_mgr()

static void test_profile_mgr ( void  )
static

Definition at line 2492 of file inputprocessor.c.

2493 {
2494  IEnumTfInputProcessorProfiles *enum_profiles;
2495  ITfInputProcessorProfileMgr *ipp_mgr;
2496  HRESULT hres;
2497 
2498  hres = ITfInputProcessorProfiles_QueryInterface(g_ipp, &IID_ITfInputProcessorProfileMgr, (void**)&ipp_mgr);
2499  if (hres != S_OK)
2500  {
2501  win_skip("ITfInputProcessorProfileMgr is not supported.\n");
2502  return;
2503  }
2504  ok(hres == S_OK, "Could not get ITfInputProcessorProfileMgr iface: %08x\n", hres);
2505 
2506  hres = ITfInputProcessorProfileMgr_EnumProfiles(ipp_mgr, 0, &enum_profiles);
2507  ok(hres == S_OK, "EnumProfiles failed: %08x\n", hres);
2508 
2509  IEnumTfInputProcessorProfiles_Release(enum_profiles);
2510 
2511  ITfInputProcessorProfileMgr_Release(ipp_mgr);
2512 }
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
static ITfInputProcessorProfiles * g_ipp
#define win_skip
Definition: test.h:150

Referenced by START_TEST().

◆ test_Register()

static void test_Register ( void  )
static

Definition at line 1090 of file inputprocessor.c.

1091 {
1092  HRESULT hr;
1093 
1094  static const WCHAR szDesc[] = {'F','a','k','e',' ','W','i','n','e',' ','S','e','r','v','i','c','e',0};
1095  static const WCHAR szFile[] = {'F','a','k','e',' ','W','i','n','e',' ','S','e','r','v','i','c','e',' ','F','i','l','e',0};
1096 
1097  hr = ITfInputProcessorProfiles_GetCurrentLanguage(g_ipp,&gLangid);
1098  ok(SUCCEEDED(hr),"Unable to get current language id\n");
1099  trace("Current Language %x\n",gLangid);
1100 
1101  hr = RegisterTextService(&CLSID_FakeService);
1102  ok(SUCCEEDED(hr),"Unable to register COM for TextService\n");
1103  hr = ITfInputProcessorProfiles_Register(g_ipp, &CLSID_FakeService);
1104  ok(SUCCEEDED(hr),"Unable to register text service(%x)\n",hr);
1105  hr = ITfInputProcessorProfiles_AddLanguageProfile(g_ipp, &CLSID_FakeService, gLangid,
1106  &CLSID_FakeService, szDesc, ARRAY_SIZE(szDesc), szFile, ARRAY_SIZE(szFile), 1);
1107  ok(SUCCEEDED(hr),"Unable to add Language Profile (%x)\n",hr);
1108 }
HRESULT hr
Definition: shlfolder.c:183
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static HRESULT RegisterTextService(REFCLSID rclsid)
static LANGID gLangid
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
static ITfInputProcessorProfiles * g_ipp
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_RegisterCategory()

static void test_RegisterCategory ( void  )
static

Definition at line 1165 of file inputprocessor.c.

1166 {
1167  HRESULT hr;
1168  hr = ITfCategoryMgr_RegisterCategory(g_cm, &CLSID_FakeService, &GUID_TFCAT_TIP_KEYBOARD, &CLSID_FakeService);
1169  ok(SUCCEEDED(hr),"ITfCategoryMgr_RegisterCategory failed\n");
1170  hr = ITfCategoryMgr_RegisterCategory(g_cm, &CLSID_FakeService, &GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER, &CLSID_FakeService);
1171  ok(SUCCEEDED(hr),"ITfCategoryMgr_RegisterCategory failed\n");
1172 }
static ITfCategoryMgr * g_cm
HRESULT hr
Definition: shlfolder.c:183
LONG HRESULT
Definition: typedefs.h:77
#define ok(value,...)
Definition: atltest.h:57
EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD
Definition: msctf.idl:62
EXTERN_C const GUID GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER
Definition: msctf.idl:65
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_startSession()

static void test_startSession ( void  )
static

Definition at line 1665 of file inputprocessor.c.

1666 {
1667  HRESULT hr;
1668  DWORD cnt;
1669  DWORD editCookie;
1670  ITfDocumentMgr *dmtest;
1671  ITfContext *cxt,*cxt2,*cxt3,*cxtTest;
1672  ITextStoreACP *ts = NULL;
1673  TfClientId cid2 = 0;
1674  ITfThreadMgrEx *tmex;
1675 
1676  hr = ITfThreadMgr_Deactivate(g_tm);
1677  ok(hr == E_UNEXPECTED,"Deactivate should have failed with E_UNEXPECTED\n");
1678 
1680  hr = ITfThreadMgr_Activate(g_tm,&cid);
1681  ok(SUCCEEDED(hr),"Failed to Activate\n");
1682  ok(cid != tid,"TextService id mistakenly matches Client id\n");
1683 
1684  todo_wine ok(fake_service_onactivated_flags & TF_IPSINK_FLAG_ACTIVE, "Expected OnActivated callback\n");
1685 
1687  hr = ITfThreadMgr_Activate(g_tm,&cid2);
1688  ok(SUCCEEDED(hr),"Failed to Activate\n");
1689  ok(cid == cid2, "Second activate client ID does not match\n");
1690 
1691  hr = ITfThreadMgr_QueryInterface(g_tm, &IID_ITfThreadMgrEx, (void **)&tmex);
1692  if (hr == S_OK)
1693  {
1694  hr = ITfThreadMgrEx_ActivateEx(tmex, &cid2, 0);
1695  ok(SUCCEEDED(hr), "Failed to Activate\n");
1696  ok(cid == cid2, "ActivateEx client ID does not match\n");
1697 
1698  ITfThreadMgrEx_Release(tmex);
1699  }
1700  else
1701  win_skip("ITfThreadMgrEx is not supported\n");
1702 
1703  hr = ITfThreadMgr_Deactivate(g_tm);
1704  ok(SUCCEEDED(hr), "Failed to Deactivate\n");
1705  hr = ITfThreadMgr_Deactivate(g_tm);
1706  ok(SUCCEEDED(hr), "Failed to Deactivate\n");
1707 
1709 
1710  hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&g_dm);
1711  ok(SUCCEEDED(hr),"CreateDocumentMgr failed\n");
1712 
1714 
1715  hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&dmtest);
1716  ok(SUCCEEDED(hr),"CreateDocumentMgr failed\n");
1717 
1718  test_EnumDocumentMgr(g_tm,dmtest,NULL);
1719 
1720  ITfDocumentMgr_Release(dmtest);
1721  test_EnumDocumentMgr(g_tm,g_dm,dmtest);
1722 
1723  hr = ITfThreadMgr_GetFocus(g_tm,&dmtest);
1724  ok(SUCCEEDED(hr),"GetFocus Failed\n");
1725  ok(dmtest == NULL,"Initial focus not null\n");
1726 
1728  test_PrevFocus = NULL;
1729  test_OnSetFocus = SINK_OPTIONAL; /* Doesn't always fire on Win7 */
1730  hr = ITfThreadMgr_SetFocus(g_tm,g_dm);
1731  ok(SUCCEEDED(hr),"SetFocus Failed\n");
1732  sink_check_ok(&test_OnSetFocus,"OnSetFocus");
1733 
1734  hr = ITfThreadMgr_GetFocus(g_tm,&dmtest);
1735  ok(SUCCEEDED(hr),"GetFocus Failed\n");
1736  ok(g_dm == dmtest,"Expected DocumentMgr not focused\n");
1737 
1738  ITfDocumentMgr_Release(g_dm);
1739 
1740  hr = ITfThreadMgr_GetFocus(g_tm,&dmtest);
1741  ok(SUCCEEDED(hr),"GetFocus Failed\n");
1742  ok(g_dm == dmtest,"Expected DocumentMgr not focused\n");
1743  ITfDocumentMgr_Release(dmtest);
1744 
1746  ok(SUCCEEDED(hr),"Constructor Failed\n");
1747  if (FAILED(hr)) return;
1748 
1749  hr = ITfDocumentMgr_CreateContext(g_dm, cid, 0, (IUnknown*)ts, &cxt, &editCookie);
1750  ok(SUCCEEDED(hr),"CreateContext Failed\n");
1751 
1752  hr = ITfDocumentMgr_CreateContext(g_dm, cid, 0, NULL, &cxt2, &editCookie);
1753  ok(SUCCEEDED(hr),"CreateContext Failed\n");
1754 
1755  hr = ITfDocumentMgr_CreateContext(g_dm, cid, 0, NULL, &cxt3, &editCookie);
1756  ok(SUCCEEDED(hr),"CreateContext Failed\n");
1757 
1759 
1760  hr = ITfContext_GetDocumentMgr(cxt,&dmtest);
1761  ok(hr == S_OK, "ITfContext_GetDocumentMgr failed with %x\n",hr);
1762  ok(dmtest == g_dm, "Wrong documentmgr\n");
1763  ITfDocumentMgr_Release(dmtest);
1764 
1765  cnt = check_context_refcount(cxt);
1769  hr = ITfDocumentMgr_Push(g_dm, cxt);
1770  ok(SUCCEEDED(hr),"Push Failed\n");
1771  ok(check_context_refcount(cxt) > cnt, "Ref count did not increase\n");
1772  sink_check_ok(&test_OnPushContext,"OnPushContext");
1773  sink_check_ok(&test_OnInitDocumentMgr,"OnInitDocumentMgr");
1774  sink_check_ok(&test_ACP_AdviseSink,"TextStoreACP_AdviseSink");
1775 
1776  test_EnumContexts(g_dm, cxt);
1777 
1778  hr = ITfDocumentMgr_GetTop(g_dm, &cxtTest);
1779  ok(SUCCEEDED(hr),"GetTop Failed\n");
1780  ok(cxtTest == cxt, "Wrong context on top\n");
1781  ok(check_context_refcount(cxt) > cnt, "Ref count did not increase\n");
1782  cnt = ITfContext_Release(cxtTest);
1783 
1784  hr = ITfDocumentMgr_GetBase(g_dm, &cxtTest);
1785  ok(SUCCEEDED(hr),"GetBase Failed\n");
1786  ok(cxtTest == cxt, "Wrong context on Base\n");
1787  ok(check_context_refcount(cxt) > cnt, "Ref count did not increase\n");
1788  ITfContext_Release(cxtTest);
1789 
1790  check_context_refcount(cxt2);
1792  hr = ITfDocumentMgr_Push(g_dm, cxt2);
1793  ok(SUCCEEDED(hr),"Push Failed\n");
1794  sink_check_ok(&test_OnPushContext,"OnPushContext");
1795 
1796  cnt = check_context_refcount(cxt2);
1797  hr = ITfDocumentMgr_GetTop(g_dm, &cxtTest);
1798  ok(SUCCEEDED(hr),"GetTop Failed\n");
1799  ok(cxtTest == cxt2, "Wrong context on top\n");
1800  ok(check_context_refcount(cxt2) > cnt, "Ref count did not increase\n");
1801  ITfContext_Release(cxtTest);
1802 
1803  cnt = check_context_refcount(cxt);
1804  hr = ITfDocumentMgr_GetBase(g_dm, &cxtTest);
1805  ok(SUCCEEDED(hr),"GetBase Failed\n");
1806  ok(cxtTest == cxt, "Wrong context on Base\n");
1807  ok(check_context_refcount(cxt) > cnt, "Ref count did not increase\n");
1808  ITfContext_Release(cxtTest);
1809 
1810  cnt = check_context_refcount(cxt3);
1811  hr = ITfDocumentMgr_Push(g_dm, cxt3);
1812  ok(FAILED(hr),"Push Succeeded\n");
1813  ok(check_context_refcount(cxt3) == cnt, "Ref changed\n");
1814 
1815  cnt = check_context_refcount(cxt2);
1816  hr = ITfDocumentMgr_GetTop(g_dm, &cxtTest);
1817  ok(SUCCEEDED(hr),"GetTop Failed\n");
1818  ok(cxtTest == cxt2, "Wrong context on top\n");
1819  ok(check_context_refcount(cxt2) > cnt, "Ref count did not increase\n");
1820  ITfContext_Release(cxtTest);
1821 
1822  cnt = check_context_refcount(cxt);
1823  hr = ITfDocumentMgr_GetBase(g_dm, &cxtTest);
1824  ok(SUCCEEDED(hr),"GetBase Failed\n");
1825  ok(cxtTest == cxt, "Wrong context on Base\n");
1826  ok(check_context_refcount(cxt) > cnt, "Ref count did not increase\n");
1827  ITfContext_Release(cxtTest);
1828 
1829  cnt = check_context_refcount(cxt2);
1831  hr = ITfDocumentMgr_Pop(g_dm, 0);
1832  ok(SUCCEEDED(hr),"Pop Failed\n");
1833  ok(check_context_refcount(cxt2) < cnt, "Ref count did not decrease\n");
1834  sink_check_ok(&test_OnPopContext,"OnPopContext");
1835 
1836  dmtest = (void *)0xfeedface;
1837  hr = ITfContext_GetDocumentMgr(cxt2,&dmtest);
1838  ok(hr == S_FALSE, "ITfContext_GetDocumentMgr wrong rc %x\n",hr);
1839  ok(dmtest == NULL,"returned documentmgr should be null\n");
1840 
1841  ITfContext_Release(cxt2);
1842 
1843  hr = ITfDocumentMgr_GetTop(g_dm, &cxtTest);
1844  ok(SUCCEEDED(hr),"GetTop Failed\n");
1845  ok(cxtTest == cxt, "Wrong context on top\n");
1846  ITfContext_Release(cxtTest);
1847 
1848  hr = ITfDocumentMgr_GetBase(g_dm, &cxtTest);
1849  ok(SUCCEEDED(hr),"GetBase Failed\n");
1850  ok(cxtTest == cxt, "Wrong context on base\n");
1851  ITfContext_Release(cxtTest);
1852 
1853  hr = ITfDocumentMgr_CreateContext(g_dm, cid, 0, (IUnknown*)ts, &cxt2, &editCookie);
1854  ok(hr == S_OK,"CreateContext Failed\n");
1855 
1858  hr = ITfDocumentMgr_Push(g_dm, cxt2);
1859  ok(hr == S_OK,"Push Failed\n");
1860  sink_check_ok(&test_OnPushContext,"OnPushContext");
1861  sink_check_ok(&test_ACP_AdviseSink,"TextStoreACP_AdviseSink");
1862 
1864  cnt = check_context_refcount(cxt2);
1866  hr = ITfDocumentMgr_Pop(g_dm, 0);
1867  ok(hr == S_OK,"Pop Failed\n");
1868  ok(check_context_refcount(cxt2) < cnt, "Ref count did not decrease\n");
1869  sink_check_ok(&test_OnPopContext,"OnPopContext");
1870  sink_check_ok(&test_ACP_UnadviseSink,"TextStoreACP_AdviseSink");
1871 
1872  hr = ITfDocumentMgr_Pop(g_dm, 0);
1873  ok(FAILED(hr),"Pop Succeeded\n");
1874 
1875  hr = ITfDocumentMgr_GetTop(g_dm, &cxtTest);
1876  ok(SUCCEEDED(hr),"GetTop Failed\n");
1877  ok(cxtTest == cxt, "Wrong context on top\n");
1878  ITfContext_Release(cxtTest);
1879 
1880  hr = ITfDocumentMgr_GetBase(g_dm, &cxtTest);
1881  ok(SUCCEEDED(hr),"GetBase Failed\n");
1882  ok(cxtTest == cxt, "Wrong context on base\n");
1883  ITfContext_Release(cxtTest);
1884 
1885  ITfContext_Release(cxt);
1886  ITfContext_Release(cxt2);
1887  ITfContext_Release(cxt3);
1888  ITextStoreACP_Release(ts);
1889 }
#define TRUE
Definition: types.h:120
static INT test_OnPopContext
HRESULT hr
Definition: shlfolder.c:183
static TfClientId cid
#define SINK_OPTIONAL
#define S_FALSE
Definition: winerror.h:2357
static INT test_OnPushContext
static const char * ts(int t)
static BOOL test_ShouldActivate
smooth NULL
Definition: ftsmooth.c:416
static INT test_ACP_AdviseSink
static int check_context_refcount(ITfContext *iface)
#define SINK_EXPECTED
static ITfDocumentMgr * test_CurrentFocus
static ITfThreadMgr * g_tm
static INT test_OnInitDocumentMgr
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static INT test_OnSetFocus
#define todo_wine
Definition: test.h:163
static INT test_ACP_UnadviseSink
static void test_EnumDocumentMgr(ITfThreadMgr *tm, ITfDocumentMgr *search, ITfDocumentMgr *absent)
#define S_OK
Definition: intsafe.h:59
static ITfDocumentMgr * test_PrevFocus
static void test_EnumContexts(ITfDocumentMgr *dm, ITfContext *search)
#define ok(value,...)
Definition: atltest.h:57
#define sink_check_ok(a, b)
#define E_UNEXPECTED
Definition: winerror.h:2456
DWORD TfClientId
Definition: msctf.idl:68
static DWORD fake_service_onactivated_flags
static HRESULT TextStoreACP_Constructor(IUnknown **ppOut)
#define win_skip
Definition: test.h:150
static TfClientId tid
static ITfDocumentMgr * g_dm
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_TfGuidAtom()

static void test_TfGuidAtom ( void  )
static

Definition at line 1904 of file inputprocessor.c.

1905 {
1906  GUID gtest,g1;
1907  HRESULT hr;
1908  TfGuidAtom atom1,atom2;
1909  BOOL equal;
1910 
1911  CoCreateGuid(&gtest);
1912 
1913  /* msdn reports this should return E_INVALIDARG. However my test show it crashing (winxp)*/
1914  /*
1915  hr = ITfCategoryMgr_RegisterGUID(g_cm,&gtest,NULL);
1916  ok(hr==E_INVALIDARG,"ITfCategoryMgr_RegisterGUID should have failed\n");
1917  */
1918  hr = ITfCategoryMgr_RegisterGUID(g_cm,&gtest,&atom1);
1919  ok(SUCCEEDED(hr),"ITfCategoryMgr_RegisterGUID failed\n");
1920  hr = ITfCategoryMgr_RegisterGUID(g_cm,&gtest,&atom2);
1921  ok(SUCCEEDED(hr),"ITfCategoryMgr_RegisterGUID failed\n");
1922  ok(atom1 == atom2,"atoms do not match\n");
1923  hr = ITfCategoryMgr_GetGUID(g_cm,atom2,NULL);
1924  ok(hr==E_INVALIDARG,"ITfCategoryMgr_GetGUID should have failed\n");
1925  hr = ITfCategoryMgr_GetGUID(g_cm,atom2,&g1);
1926  ok(SUCCEEDED(hr),"ITfCategoryMgr_GetGUID failed\n");
1927  ok(IsEqualGUID(&g1,&gtest),"guids do not match\n");
1928  hr = ITfCategoryMgr_IsEqualTfGuidAtom(g_cm,atom1,&gtest,NULL);
1929  ok(hr==E_INVALIDARG,"ITfCategoryMgr_IsEqualTfGuidAtom should have failed\n");
1930  hr = ITfCategoryMgr_IsEqualTfGuidAtom(g_cm,atom1,&gtest,&equal);
1931  ok(SUCCEEDED(hr),"ITfCategoryMgr_IsEqualTfGuidAtom failed\n");
1932  ok(equal == TRUE,"Equal value invalid\n");
1933 
1934  /* show that cid and tid TfClientIds are also TfGuidAtoms */
1935  hr = ITfCategoryMgr_IsEqualTfGuidAtom(g_cm,tid,&CLSID_FakeService,&equal);
1936  ok(SUCCEEDED(hr),"ITfCategoryMgr_IsEqualTfGuidAtom failed\n");
1937  ok(equal == TRUE,"Equal value invalid\n");
1938  hr = ITfCategoryMgr_GetGUID(g_cm,cid,&g1);
1939  ok(SUCCEEDED(hr),"ITfCategoryMgr_GetGUID failed\n");
1940  ok(!IsEqualGUID(&g1,&GUID_NULL),"guid should not be NULL\n");
1941 }
static ITfCategoryMgr * g_cm
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define equal(x, y)
Definition: reader.cc:56
static TfClientId cid
unsigned int BOOL
Definition: ntddk_ex.h:94
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2206
#define GUID_NULL
Definition: ks.h:106
DWORD TfGuidAtom
Definition: msctf.idl:69
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static TfClientId tid
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_ThreadMgrAdviseSinks()

static void test_ThreadMgrAdviseSinks ( void  )
static

Definition at line 1223 of file inputprocessor.c.

1224 {
1225  ITfSource *source = NULL;
1226  HRESULT hr;
1227  IUnknown *sink;
1228 
1229  hr = ITfThreadMgr_QueryInterface(g_tm, &IID_ITfSource, (LPVOID*)&source);
1230  ok(SUCCEEDED(hr),"Failed to get IID_ITfSource for ThreadMgr\n");
1231  if (!source)
1232  return;
1233 
1235  ok(hr == S_OK, "got %08x\n", hr);
1236  if(FAILED(hr)) return;
1237 
1238  tmSinkRefCount = 1;
1239  tmSinkCookie = 0;
1240  hr = ITfSource_AdviseSink(source,&IID_ITfThreadMgrEventSink, sink, &tmSinkCookie);
1241  ok(hr == S_OK, "Failed to Advise ITfThreadMgrEventSink\n");
1242  ok(tmSinkCookie!=0,"Failed to get sink cookie\n");
1243 
1244  /* Advising the sink adds a ref, Releasing here lets the object be deleted
1245  when unadvised */
1246  tmSinkRefCount = 2;
1247  IUnknown_Release(sink);
1248 
1249  hr = ITfSource_AdviseSink(source, &IID_ITfKeyTraceEventSink, (IUnknown*)&TfKeyTraceEventSink,
1251  ok(hr == S_OK, "Failed to Advise ITfKeyTraceEventSink\n");
1252 
1253  hr = ITfSource_AdviseSink(source, &IID_ITfUIElementSink, (IUnknown*)&TfUIElementSink,
1255  ok(hr == S_OK, "Failed to Advise ITfUIElementSink\n");
1256 
1257  hr = ITfSource_AdviseSink(source, &IID_ITfInputProcessorProfileActivationSink, (IUnknown*)&TfInputProcessorProfileActivationSink,
1259  ok(hr == S_OK, "Failed to Advise ITfInputProcessorProfileActivationSink\n");
1260 
1261  ITfSource_Release(source);
1262 }
HRESULT hr
Definition: shlfolder.c:183
static DWORD key_trace_sink_cookie
static DWORD profile_activation_sink_cookie
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
static DWORD tmSinkCookie
static ITfInputProcessorProfileActivationSink TfInputProcessorProfileActivationSink
smooth NULL
Definition: ftsmooth.c:416
static DWORD ui_element_sink_cookie
static ITfKeyTraceEventSink TfKeyTraceEventSink
static ITfThreadMgr * g_tm
static HRESULT ThreadMgrEventSink_Constructor(IUnknown **ppOut)
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static DWORD tmSinkRefCount
#define ok(value,...)
Definition: atltest.h:57
static ITfUIElementSink TfUIElementSink
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_ThreadMgrUnadviseSinks()

static void test_ThreadMgrUnadviseSinks ( void  )
static

Definition at line 1264 of file inputprocessor.c.

1265 {
1266  ITfSource *source = NULL;
1267  HRESULT hr;
1268 
1269  hr = ITfThreadMgr_QueryInterface(g_tm, &IID_ITfSource, (LPVOID*)&source);
1270  ok(SUCCEEDED(hr),"Failed to get IID_ITfSource for ThreadMgr\n");
1271  if (!source)
1272  return;
1273 
1274  tmSinkRefCount = 1;
1275  hr = ITfSource_UnadviseSink(source, tmSinkCookie);
1276  ok(hr == S_OK, "Failed to unadvise ITfThreadMgrEventSink\n");
1277 
1278  hr = ITfSource_UnadviseSink(source, key_trace_sink_cookie);
1279  ok(hr == S_OK, "Failed to unadvise ITfKeyTraceEventSink\n");
1280 
1281  hr = ITfSource_UnadviseSink(source, ui_element_sink_cookie);
1282  ok(hr == S_OK, "Failed to unadvise ITfUIElementSink\n");
1283 
1284  hr = ITfSource_UnadviseSink(source, profile_activation_sink_cookie);
1285  ok(hr == S_OK, "Failed to unadvise ITfInputProcessorProfileActivationSink\n");
1286 
1287  ITfSource_Release(source);
1288 }
HRESULT hr
Definition: shlfolder.c:183
static DWORD key_trace_sink_cookie
static DWORD profile_activation_sink_cookie
static DWORD tmSinkCookie
smooth NULL
Definition: ftsmooth.c:416
static DWORD ui_element_sink_cookie
static ITfThreadMgr * g_tm
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static DWORD tmSinkRefCount
#define ok(value,...)
Definition: atltest.h:57
Definiti