34static ITfInputProcessorProfiles*
g_ipp;
44#define SINK_UNEXPECTED 0
45#define SINK_EXPECTED 1
48#define SINK_OPTIONAL 4
51#define SINK_ACTION_MASK 0xff
52#define SINK_OPTION_MASK 0xff00
53#define SINK_EXPECTED_COUNT_MASK 0xff0000
55#define SINK_OPTION_TODO 0x0100
57#define FOCUS_IGNORE (ITfDocumentMgr*)0xffffffff
58#define FOCUS_SAVE (ITfDocumentMgr*)0xfffffffe
89DEFINE_GUID(CLSID_FakeService, 0xEDE1A7AD,0x66DE,0x47E0,0xB6,0x20,0x3E,0x92,0xF8,0x24,0x6B,0xF3);
131#define sink_fire_ok(a,b) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _sink_fire_ok(a,b)
159#define sink_check_ok(a,b) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _sink_check_ok(a,b)
173#define sink_check_saved(s,p,c,n) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _sink_check_saved(s,p,c,n)
206 ITextStoreACP_AddRef(iface);
241 hr = IUnknown_QueryInterface(punk, &IID_ITextStoreACPSink, (
void**)&
ACPSink);
244 hr = ITextStoreACPSink_QueryInterface(
ACPSink, &IID_ITextStoreACPServices, (
void**)&
services);
246 ITextStoreACPServices_Release(
services);
262 *phrSession = ITextStoreACPSink_OnLockGranted(
ACPSink, dwLockFlags);
326 const GUID *pguidService,
const FORMATETC *pFormatEtc,
BOOL *pfInsertable)
503 ITfThreadMgrEventSink_AddRef(iface);
568 hr = ITfContext_GetDocumentMgr(pic,&docmgr);
571 hr = ITfDocumentMgr_GetTop(docmgr,&
test);
573 ITfDocumentMgr_Release(docmgr);
574 ok(
test == pic,
"Wrong context is on top\n");
576 ITfContext_Release(
test);
589 hr = ITfContext_GetDocumentMgr(pic,&docmgr);
591 ITfDocumentMgr_Release(docmgr);
593 hr = ITfDocumentMgr_GetTop(docmgr,&
test);
595 ok(
test == pic,
"Wrong context is on top\n");
597 ITfContext_Release(
test);
655 ok(0,
"unexpected call\n");
662 ok(0,
"unexpected call\n");
701 ok(0,
"unexpected call\n");
708 ok(0,
"unexpected call\n");
715 ok(0,
"unexpected call\n");
756 trace(
"Got OnActivated: {dwProfileType %08x, langid %08x, clsid %s, catid %s, guidProfile %s, %p, dwFlags %08x}\n",
760 ok(dwProfileType == TF_PROFILETYPE_INPUTPROCESSOR || dwProfileType == TF_PROFILETYPE_KEYBOARDLAYOUT,
761 "unexpected dwProfileType: 0x%x\n", dwProfileType);
763 if(dwProfileType == TF_PROFILETYPE_INPUTPROCESSOR &&
IsEqualGUID(&CLSID_FakeService,
clsid)){
764 if(
dwFlags & TF_IPSINK_FLAG_ACTIVE){
809 ok(0,
"unexpected call\n");
866 IClassFactory_AddRef(iface);
899 ret = IUnknown_QueryInterface(
obj, iid, ppvOut);
900 IUnknown_Release(
obj);
931 *ppvOut = &
This->IClassFactory_iface;
952 ITfTextInputProcessor_AddRef(iface);
979 trace(
"TextService_Activate\n");
987 trace(
"TextService_Deactivate\n");
1015 *ppOut = (
IUnknown*)&
This->ITfTextInputProcessor_iface;
1034DEFINE_GUID(
CLSID_TF_InputProcessorProfiles, 0x33c53a50,0xf456,0x4884,0xb0,0x49,0x85,0xfd,0x64,0x3e,0xcf,0xed);
1035DEFINE_GUID(
CLSID_TF_CategoryMgr, 0xA4B544A1,0x438D,0x4B41,0x93,0x25,0x86,0x95,0x23,0xE2,0xD6,0xC7);
1036DEFINE_GUID(
GUID_TFCAT_TIP_KEYBOARD, 0x34745c63,0xb2f0,0x4784,0x8b,0x67,0x5e,0x12,0xc8,0x70,0x1a,0x31);
1037DEFINE_GUID(
GUID_TFCAT_TIP_SPEECH, 0xB5A73CD1,0x8355,0x426B,0xA1,0x61,0x25,0x98,0x08,0xF2,0x6B,0x14);
1038DEFINE_GUID(
GUID_TFCAT_TIP_HANDWRITING, 0x246ecb87,0xc2f2,0x4abe,0x90,0x5b,0xc8,0xb3,0x8a,0xdd,0x2c,0x43);
1039DEFINE_GUID (
GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER, 0x046B8C80,0x1647,0x40F7,0x9B,0x21,0xB9,0x3B,0x81,0xAA,0xBC,0x1B);
1040DEFINE_GUID(
GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
1041DEFINE_GUID(
CLSID_TF_ThreadMgr, 0x529a9e6b,0x6587,0x4f23,0xab,0x9e,0x9c,0x7d,0x68,0x3e,0x3c,0x50);
1042DEFINE_GUID(CLSID_PreservedKey, 0xA0ED8E55,0xCD3B,0x4274,0xB2,0x95,0xF6,0xC9,0xBA,0x2B,0x84,0x72);
1043DEFINE_GUID(
GUID_COMPARTMENT_KEYBOARD_DISABLED, 0x71a5b253,0x1951,0x466b,0x9f,0xbc,0x9c,0x88,0x08,0xfa,0x84,0xf2);
1044DEFINE_GUID(
GUID_COMPARTMENT_KEYBOARD_OPENCLOSE, 0x58273aad,0x01bb,0x4164,0x95,0xc6,0x75,0x5b,0xa0,0xb5,0x16,0x2d);
1045DEFINE_GUID(
GUID_COMPARTMENT_HANDWRITING_OPENCLOSE, 0xf9ae2c6b,0x1866,0x4361,0xaf,0x72,0x7a,0xa3,0x09,0x48,0x89,0x0e);
1046DEFINE_GUID(
GUID_COMPARTMENT_SPEECH_DISABLED, 0x56c5c607,0x0703,0x4e59,0x8e,0x52,0xcb,0xc8,0x4e,0x8b,0xbe,0x35);
1047DEFINE_GUID(
GUID_COMPARTMENT_SPEECH_OPENCLOSE, 0x544d6a63,0xe2e8,0x4752,0xbb,0xd1,0x00,0x09,0x60,0xbc,0xa0,0x83);
1048DEFINE_GUID(
GUID_COMPARTMENT_SPEECH_GLOBALSTATE, 0x2a54fe8e,0x0d08,0x460c,0xa7,0x5d,0x87,0x03,0x5f,0xf4,0x36,0xc5);
1049DEFINE_GUID(
GUID_COMPARTMENT_PERSISTMENUENABLED, 0x575f3783,0x70c8,0x47c8,0xae,0x5d,0x91,0xa0,0x1a,0x1f,0x75,0x92);
1050DEFINE_GUID(
GUID_COMPARTMENT_EMPTYCONTEXT, 0xd7487dbf,0x804e,0x41c5,0x89,0x4d,0xad,0x96,0xfd,0x4e,0xea,0x13);
1051DEFINE_GUID(
GUID_COMPARTMENT_TIPUISTATUS, 0x148ca3ec,0x0366,0x401c,0x8d,0x75,0xed,0x97,0x8d,0x85,0xfb,0xc9);
1063 skip(
"Not enough permission to register input processor\n");
1069 CLSCTX_INPROC_SERVER, &IID_ITfInputProcessorProfiles, (
void**)&
g_ipp);
1072 CLSCTX_INPROC_SERVER, &IID_ITfCategoryMgr, (
void**)&
g_cm);
1075 CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (
void**)&
g_tm);
1082 ITfInputProcessorProfiles_Release(
g_ipp);
1084 ITfCategoryMgr_Release(
g_cm);
1086 ITfThreadMgr_Release(
g_tm);
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};
1097 hr = ITfInputProcessorProfiles_GetCurrentLanguage(
g_ipp,&
gLangid);
1102 ok(
SUCCEEDED(
hr),
"Unable to register COM for TextService\n");
1103 hr = ITfInputProcessorProfiles_Register(
g_ipp, &CLSID_FakeService);
1105 hr = ITfInputProcessorProfiles_AddLanguageProfile(
g_ipp, &CLSID_FakeService,
gLangid,
1113 hr = ITfInputProcessorProfiles_Unregister(
g_ipp, &CLSID_FakeService);
1123 if (
SUCCEEDED(ITfInputProcessorProfiles_EnumInputProcessorInfo(
g_ipp, &ppEnum)))
1127 while (IEnumGUID_Next(ppEnum, 1, &
g, &fetched) ==
S_OK)
1132 IEnumGUID_Release(ppEnum);
1134 ok(found,
"Did not find registered text service\n");
1160 IEnumTfLanguageProfiles_Release(ppEnum);
1162 ok(found,
"Registered text service not found\n");
1169 ok(
SUCCEEDED(
hr),
"ITfCategoryMgr_RegisterCategory failed\n");
1171 ok(
SUCCEEDED(
hr),
"ITfCategoryMgr_RegisterCategory failed\n");
1178 ok(
SUCCEEDED(
hr),
"ITfCategoryMgr_UnregisterCategory failed\n");
1180 ok(
SUCCEEDED(
hr),
"ITfCategoryMgr_UnregisterCategory failed\n");
1189 hr = ITfCategoryMgr_FindClosestCategory(
g_cm, &CLSID_FakeService, &output,
NULL, 0);
1190 ok(
SUCCEEDED(
hr),
"ITfCategoryMgr_FindClosestCategory failed (%x)\n",
hr);
1193 hr = ITfCategoryMgr_FindClosestCategory(
g_cm, &CLSID_FakeService, &output,
list, 1);
1194 ok(
SUCCEEDED(
hr),
"ITfCategoryMgr_FindClosestCategory failed (%x)\n",
hr);
1197 hr = ITfCategoryMgr_FindClosestCategory(
g_cm, &CLSID_FakeService, &output,
list, 3);
1198 ok(
SUCCEEDED(
hr),
"ITfCategoryMgr_FindClosestCategory failed (%x)\n",
hr);
1207 hr = ITfInputProcessorProfiles_EnableLanguageProfile(
g_ipp,&CLSID_FakeService,
gLangid, &CLSID_FakeService,
TRUE);
1209 hr = ITfInputProcessorProfiles_IsEnabledLanguageProfile(
g_ipp,&CLSID_FakeService,
gLangid, &CLSID_FakeService, &
enabled);
1218 trace(
"Disabling\n");
1219 hr = ITfInputProcessorProfiles_EnableLanguageProfile(
g_ipp,&CLSID_FakeService,
gLangid, &CLSID_FakeService,
FALSE);
1230 ok(
SUCCEEDED(
hr),
"Failed to get IID_ITfSource for ThreadMgr\n");
1241 ok(
hr ==
S_OK,
"Failed to Advise ITfThreadMgrEventSink\n");
1247 IUnknown_Release(
sink);
1251 ok(
hr ==
S_OK,
"Failed to Advise ITfKeyTraceEventSink\n");
1255 ok(
hr ==
S_OK,
"Failed to Advise ITfUIElementSink\n");
1259 ok(
hr ==
S_OK,
"Failed to Advise ITfInputProcessorProfileActivationSink\n");
1261 ITfSource_Release(
source);
1270 ok(
SUCCEEDED(
hr),
"Failed to get IID_ITfSource for ThreadMgr\n");
1276 ok(
hr ==
S_OK,
"Failed to unadvise ITfThreadMgrEventSink\n");
1279 ok(
hr ==
S_OK,
"Failed to unadvise ITfKeyTraceEventSink\n");
1282 ok(
hr ==
S_OK,
"Failed to unadvise ITfUIElementSink\n");
1285 ok(
hr ==
S_OK,
"Failed to unadvise ITfInputProcessorProfileActivationSink\n");
1287 ITfSource_Release(
source);
1295 hr = ITfDocumentMgr_QueryInterface(
g_dm, &IID_ITfSource, (
void**)&
source);
1296 ok(
hr ==
S_OK,
"Failed to get IID_ITfSource for DocumentMgr\n");
1300 ok(
hr ==
S_OK,
"Failed to Advise Sink\n");
1302 ITfSource_Release(
source);
1310 hr = ITfDocumentMgr_QueryInterface(
g_dm, &IID_ITfSource, (
void**)&
source);
1311 ok(
hr ==
S_OK,
"Failed to get IID_ITfSource for DocumentMgr\n");
1314 ok(
hr ==
S_OK,
"Failed to unadvise Sink\n");
1315 ITfSource_Release(
source);
1348 ITfKeyEventSink_AddRef(iface);
1439 *ppOut = &
This->ITfKeyEventSink_iface;
1454 hr = ITfThreadMgr_QueryInterface(
g_tm, &IID_ITfKeystrokeMgr, (
LPVOID*)&keymgr);
1455 ok(
SUCCEEDED(
hr),
"Failed to get IID_ITfKeystrokeMgr for ThreadMgr\n");
1461 hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,
tid,
sink,
TRUE);
1462 ok(
SUCCEEDED(
hr),
"ITfKeystrokeMgr_AdviseKeyEventSink failed\n");
1464 hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,
tid,
sink,
TRUE);
1466 hr = ITfKeystrokeMgr_AdviseKeyEventSink(keymgr,
cid,
sink,
TRUE);
1469 hr =ITfKeystrokeMgr_PreserveKey(keymgr, 0, &CLSID_PreservedKey, &tfpk,
NULL, 0);
1472 hr =ITfKeystrokeMgr_PreserveKey(keymgr,
tid, &CLSID_PreservedKey, &tfpk,
NULL, 0);
1475 hr =ITfKeystrokeMgr_PreserveKey(keymgr,
tid, &CLSID_PreservedKey, &tfpk,
NULL, 0);
1476 ok(
hr == TF_E_ALREADY_EXISTS,
"ITfKeystrokeMgr_PreserveKey improperly succeeded\n");
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");
1483 hr = ITfKeystrokeMgr_UnpreserveKey(keymgr, &CLSID_PreservedKey,&tfpk);
1486 hr = ITfKeystrokeMgr_IsPreservedKey(keymgr, &CLSID_PreservedKey, &tfpk, &preserved);
1487 ok(
hr ==
S_FALSE,
"ITfKeystrokeMgr_IsPreservedKey failed\n");
1490 hr = ITfKeystrokeMgr_UnpreserveKey(keymgr, &CLSID_PreservedKey,&tfpk);
1493 hr = ITfKeystrokeMgr_UnadviseKeyEventSink(keymgr,
tid);
1494 ok(
SUCCEEDED(
hr),
"ITfKeystrokeMgr_UnadviseKeyEventSink failed\n");
1496 ITfKeystrokeMgr_Release(keymgr);
1497 ITfKeyEventSink_Release(
sink);
1505 hr = ITfInputProcessorProfiles_ActivateLanguageProfile(
g_ipp,&CLSID_FakeService,
gLangid,&CLSID_FakeService);
1517 hr = ITfDocumentMgr_EnumContexts(dm,&pEnum);
1523 while (IEnumTfContexts_Next(pEnum, 1, &cxt, &fetched) ==
S_OK)
1529 ITfContext_Release(cxt);
1531 IEnumTfContexts_Release(pEnum);
1534 ok(found,
"Did not find proper ITfContext\n");
1536 ok(!found,
"Found an ITfContext we should should not have\n");
1546 hr = ITfThreadMgr_EnumDocumentMgrs(
tm,&pEnum);
1552 while (IEnumTfDocumentMgrs_Next(pEnum, 1, &dm, &fetched) ==
S_OK)
1558 if (absent && dm == absent)
1560 ITfDocumentMgr_Release(dm);
1562 IEnumTfDocumentMgrs_Release(pEnum);
1565 ok(found,
"Did not find proper ITfDocumentMgr\n");
1567 ok(!found,
"Found an ITfDocumentMgr we should should not have\n");
1569 ok(notfound,
"Found an ITfDocumentMgr we believe should be absent\n");
1574 ITfContext_AddRef(iface);
1575 return ITfContext_Release(iface);
1609 ITfTextEditSink_AddRef(iface);
1661 *ppOut = &
This->ITfTextEditSink_iface;
1676 hr = ITfThreadMgr_Deactivate(
g_tm);
1677 ok(
hr ==
E_UNEXPECTED,
"Deactivate should have failed with E_UNEXPECTED\n");
1682 ok(
cid !=
tid,
"TextService id mistakenly matches Client id\n");
1687 hr = ITfThreadMgr_Activate(
g_tm,&cid2);
1689 ok(
cid == cid2,
"Second activate client ID does not match\n");
1691 hr = ITfThreadMgr_QueryInterface(
g_tm, &IID_ITfThreadMgrEx, (
void **)&tmex);
1694 hr = ITfThreadMgrEx_ActivateEx(tmex, &cid2, 0);
1696 ok(
cid == cid2,
"ActivateEx client ID does not match\n");
1698 ITfThreadMgrEx_Release(tmex);
1701 win_skip(
"ITfThreadMgrEx is not supported\n");
1703 hr = ITfThreadMgr_Deactivate(
g_tm);
1705 hr = ITfThreadMgr_Deactivate(
g_tm);
1710 hr = ITfThreadMgr_CreateDocumentMgr(
g_tm,&
g_dm);
1715 hr = ITfThreadMgr_CreateDocumentMgr(
g_tm,&dmtest);
1720 ITfDocumentMgr_Release(dmtest);
1723 hr = ITfThreadMgr_GetFocus(
g_tm,&dmtest);
1725 ok(dmtest ==
NULL,
"Initial focus not null\n");
1734 hr = ITfThreadMgr_GetFocus(
g_tm,&dmtest);
1736 ok(
g_dm == dmtest,
"Expected DocumentMgr not focused\n");
1738 ITfDocumentMgr_Release(
g_dm);
1740 hr = ITfThreadMgr_GetFocus(
g_tm,&dmtest);
1742 ok(
g_dm == dmtest,
"Expected DocumentMgr not focused\n");
1743 ITfDocumentMgr_Release(dmtest);
1749 hr = ITfDocumentMgr_CreateContext(
g_dm,
cid, 0, (
IUnknown*)ts, &cxt, &editCookie);
1752 hr = ITfDocumentMgr_CreateContext(
g_dm,
cid, 0,
NULL, &cxt2, &editCookie);
1755 hr = ITfDocumentMgr_CreateContext(
g_dm,
cid, 0,
NULL, &cxt3, &editCookie);
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);
1769 hr = ITfDocumentMgr_Push(
g_dm, cxt);
1778 hr = ITfDocumentMgr_GetTop(
g_dm, &cxtTest);
1780 ok(cxtTest == cxt,
"Wrong context on top\n");
1782 cnt = ITfContext_Release(cxtTest);
1784 hr = ITfDocumentMgr_GetBase(
g_dm, &cxtTest);
1786 ok(cxtTest == cxt,
"Wrong context on Base\n");
1788 ITfContext_Release(cxtTest);
1792 hr = ITfDocumentMgr_Push(
g_dm, cxt2);
1797 hr = ITfDocumentMgr_GetTop(
g_dm, &cxtTest);
1799 ok(cxtTest == cxt2,
"Wrong context on top\n");
1801 ITfContext_Release(cxtTest);
1804 hr = ITfDocumentMgr_GetBase(
g_dm, &cxtTest);
1806 ok(cxtTest == cxt,
"Wrong context on Base\n");
1808 ITfContext_Release(cxtTest);
1811 hr = ITfDocumentMgr_Push(
g_dm, cxt3);
1816 hr = ITfDocumentMgr_GetTop(
g_dm, &cxtTest);
1818 ok(cxtTest == cxt2,
"Wrong context on top\n");
1820 ITfContext_Release(cxtTest);
1823 hr = ITfDocumentMgr_GetBase(
g_dm, &cxtTest);
1825 ok(cxtTest == cxt,
"Wrong context on Base\n");
1827 ITfContext_Release(cxtTest);
1831 hr = ITfDocumentMgr_Pop(
g_dm, 0);
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");
1841 ITfContext_Release(cxt2);
1843 hr = ITfDocumentMgr_GetTop(
g_dm, &cxtTest);
1845 ok(cxtTest == cxt,
"Wrong context on top\n");
1846 ITfContext_Release(cxtTest);
1848 hr = ITfDocumentMgr_GetBase(
g_dm, &cxtTest);
1850 ok(cxtTest == cxt,
"Wrong context on base\n");
1851 ITfContext_Release(cxtTest);
1853 hr = ITfDocumentMgr_CreateContext(
g_dm,
cid, 0, (
IUnknown*)ts, &cxt2, &editCookie);
1854 ok(
hr ==
S_OK,
"CreateContext Failed\n");
1858 hr = ITfDocumentMgr_Push(
g_dm, cxt2);
1866 hr = ITfDocumentMgr_Pop(
g_dm, 0);
1872 hr = ITfDocumentMgr_Pop(
g_dm, 0);
1875 hr = ITfDocumentMgr_GetTop(
g_dm, &cxtTest);
1877 ok(cxtTest == cxt,
"Wrong context on top\n");
1878 ITfContext_Release(cxtTest);
1880 hr = ITfDocumentMgr_GetBase(
g_dm, &cxtTest);
1882 ok(cxtTest == cxt,
"Wrong context on base\n");
1883 ITfContext_Release(cxtTest);
1885 ITfContext_Release(cxt);
1886 ITfContext_Release(cxt2);
1887 ITfContext_Release(cxt3);
1888 ITextStoreACP_Release(ts);
1898 hr = ITfThreadMgr_Deactivate(
g_tm);
1918 hr = ITfCategoryMgr_RegisterGUID(
g_cm,>est,&atom1);
1920 hr = ITfCategoryMgr_RegisterGUID(
g_cm,>est,&atom2);
1922 ok(atom1 == atom2,
"atoms do not match\n");
1923 hr = ITfCategoryMgr_GetGUID(
g_cm,atom2,
NULL);
1925 hr = ITfCategoryMgr_GetGUID(
g_cm,atom2,&g1);
1928 hr = ITfCategoryMgr_IsEqualTfGuidAtom(
g_cm,atom1,>est,
NULL);
1929 ok(
hr==
E_INVALIDARG,
"ITfCategoryMgr_IsEqualTfGuidAtom should have failed\n");
1930 hr = ITfCategoryMgr_IsEqualTfGuidAtom(
g_cm,atom1,>est,&
equal);
1931 ok(
SUCCEEDED(
hr),
"ITfCategoryMgr_IsEqualTfGuidAtom failed\n");
1935 hr = ITfCategoryMgr_IsEqualTfGuidAtom(
g_cm,
tid,&CLSID_FakeService,&
equal);
1936 ok(
SUCCEEDED(
hr),
"ITfCategoryMgr_IsEqualTfGuidAtom failed\n");
1938 hr = ITfCategoryMgr_GetGUID(
g_cm,
cid,&g1);
1950 hr = ITfThreadMgr_QueryInterface(
g_tm, &IID_ITfClientId, (
LPVOID*)&pcid);
1951 ok(
SUCCEEDED(
hr),
"Unable to acquire ITfClientId interface\n");
1955 hr = ITfClientId_GetClientId(pcid,&
GUID_NULL,&id1);
1957 hr = ITfClientId_GetClientId(pcid,&
GUID_NULL,&id2);
1959 ok(id1==id2,
"Id's for GUID_NULL do not match\n");
1960 hr = ITfClientId_GetClientId(pcid,&CLSID_FakeService,&id2);
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);
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);
2003 ITfEditSession_AddRef(iface);
2032 static const WCHAR txt[] = {
'H',
'e',
'l',
'l',
'o',
' ',
'W',
'o',
'r',
'l',
'd',0};
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);
2041 ITfRange_Release(
range);
2042 ITfInsertAtSelection_Release(iis);
2058 ITfThreadMgr_GetFocus(
g_tm, &dm);
2059 ITfDocumentMgr_GetTop(dm,&cxt);
2061 hr = ITfContext_GetStart(cxt,ec,
NULL);
2065 hr = ITfContext_GetStart(cxt,0xdeadcafe,&
range);
2066 ok(
hr == TF_E_NOLOCK,
"Unexpected return code %x\n",
hr);
2069 hr = ITfContext_GetStart(cxt,ec,&
range);
2073 ITfRange_Release(
range);
2075 hr = ITfContext_GetEnd(cxt,ec,
NULL);
2079 hr = ITfContext_GetEnd(cxt,0xdeadcafe,&
range);
2080 ok(
hr == TF_E_NOLOCK,
"Unexpected return code %x\n",
hr);
2084 hr = ITfContext_GetEnd(cxt,ec,&
range);
2089 ITfRange_Release(
range);
2093 hr = ITfContext_GetSelection(cxt, ec, TF_DEFAULT_SELECTION, 1, &
selection, &fetched);
2095 ok(fetched == 1,
"fetched incorrect\n");
2103 hr = ITfContext_GetEnd(cxt,ec,&
range);
2112 hr = ITfContext_SetSelection(cxt, ec, 1, &
selection);
2115 ITfRange_Release(
range);
2117 ITfContext_Release(cxt);
2118 ITfDocumentMgr_Release(dm);
2143 *ppOut = &
This->ITfEditSession_iface;
2155 DWORD editSinkCookie = -1;
2157 ITfThreadMgr_GetFocus(
g_tm, &dm);
2159 ITfDocumentMgr_GetTop(dm,&cxt);
2162 hr = ITfContext_QueryInterface(cxt,&IID_ITfSource,(
LPVOID*)&
source);
2163 ok(
SUCCEEDED(
hr),
"Failed to get IID_ITfSource for Context\n");
2166 hr = ITfSource_AdviseSink(
source, &IID_ITfTextEditSink, (
LPVOID)
sink, &editSinkCookie);
2168 ok(editSinkCookie != -1,
"Failed to get sink cookie\n");
2171 hrSession = 0xfeedface;
2173 hr = ITfContext_RequestEditSession(cxt,
tid,
es, TF_ES_SYNC, &hrSession);
2175 ok(hrSession ==
E_FAIL,
"hrSession should be %x not %x\n",
E_FAIL,hrSession);
2178 hrSession = 0xfeedface;
2180 hr = ITfContext_RequestEditSession(cxt,
tid,
es, TF_ES_SYNC|TF_ES_READWRITE, &hrSession);
2182 ok(hrSession == TS_E_READONLY,
"Unexpected hrSession (%x)\n",hrSession);
2194 hrSession = 0xfeedface;
2196 hr = ITfContext_RequestEditSession(cxt,
tid,
es, TF_ES_SYNC|TF_ES_READWRITE, &hrSession);
2201 ok(hrSession == 0xdeadcafe,
"Unexpected hrSession (%x)\n",hrSession);
2205 hr = ITfSource_UnadviseSink(
source, editSinkCookie);
2207 ITfSource_Release(
source);
2209 ITfTextEditSink_Release(
sink);
2210 ITfContext_Release(cxt);
2211 ITfDocumentMgr_Release(dm);
2212 ITfEditSession_Release(
es);
2221 if (
SUCCEEDED(ITfCompartmentMgr_EnumCompartments(cmpmgr, &ppEnum)))
2225 while (IEnumGUID_Next(ppEnum, 1, &
g, &fetched) ==
S_OK)
2237 IEnumGUID_Release(ppEnum);
2240 ok(found,
"Did not find compartment\n");
2242 ok(!found2,
"Found compartment that should be absent\n");
2253 ITfThreadMgr_GetFocus(
g_tm, &dm);
2254 ITfDocumentMgr_GetTop(dm,&cxt);
2257 hr = ITfThreadMgr_GetGlobalCompartment(
g_tm, &cmpmgr);
2261 ITfCompartment_Release(
cmp);
2263 ITfCompartmentMgr_Release(cmpmgr);
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);
2271 ITfCompartmentMgr_ClearCompartment(cmpmgr,
tid,&CLSID_FakeService);
2273 ITfCompartmentMgr_Release(cmpmgr);
2274 ITfCompartment_Release(
cmp);
2277 hr = ITfDocumentMgr_QueryInterface(dm, &IID_ITfCompartmentMgr, (
LPVOID*)&cmpmgr);
2278 ok(
SUCCEEDED(
hr),
"DocumentMgr QI for IID_ITfCompartmentMgr failed\n");
2283 ITfCompartmentMgr_Release(cmpmgr);
2286 hr = ITfContext_QueryInterface(cxt, &IID_ITfCompartmentMgr, (
LPVOID*)&cmpmgr);
2287 ok(
SUCCEEDED(
hr),
"Context QI for IID_ITfCompartmentMgr failed\n");
2289 ITfCompartmentMgr_Release(cmpmgr);
2291 ITfContext_Release(cxt);
2292 ITfDocumentMgr_Release(dm);
2299 int min_timeout = 100;
2318 HWND wnd1, wnd2, wnd3;
2321 ITfThreadMgr_GetFocus(
g_tm, &dmorig);
2330 ITfDocumentMgr_Release(dmorig);
2332 hr = ITfThreadMgr_CreateDocumentMgr(
g_tm,&dm1);
2335 hr = ITfThreadMgr_CreateDocumentMgr(
g_tm,&dm2);
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");
2373 hr = ITfThreadMgr_AssociateFocus(
g_tm,wnd1,dm1,&olddm);
2380 ITfThreadMgr_GetFocus(
g_tm, &dmcheck);
2381 ok(dmcheck == dm1 ||
broken(dmcheck == dmorig ),
"Expected DocumentMgr not focused\n");
2382 ITfDocumentMgr_Release(dmcheck);
2388 ITfThreadMgr_SetFocus(
g_tm, dm1);
2391 hr = ITfThreadMgr_AssociateFocus(
g_tm,wnd2,dm2,&olddm);
2394 ITfThreadMgr_GetFocus(
g_tm, &dmcheck);
2395 ok(dmcheck == dm1,
"Expected DocumentMgr not focused\n");
2396 ITfDocumentMgr_Release(dmcheck);
2398 hr = ITfThreadMgr_AssociateFocus(
g_tm,wnd3,dm2,&olddm);
2401 ITfThreadMgr_GetFocus(
g_tm, &dmcheck);
2402 ok(dmcheck == dm1,
"Expected DocumentMgr not focused\n");
2403 ITfDocumentMgr_Release(dmcheck);
2429 hr = ITfThreadMgr_AssociateFocus(
g_tm,wnd3,
NULL,&olddm);
2431 ok(olddm == dm2,
"incorrect old DocumentMgr returned\n");
2432 ITfDocumentMgr_Release(olddm);
2438 ITfThreadMgr_SetFocus(
g_tm,dmorig);
2448 hr = ITfThreadMgr_AssociateFocus(
g_tm,wnd2,
NULL,&olddm);
2450 ok(olddm == dm2,
"incorrect old DocumentMgr returned\n");
2451 ITfDocumentMgr_Release(olddm);
2452 hr = ITfThreadMgr_AssociateFocus(
g_tm,wnd1,
NULL,&olddm);
2454 ok(olddm == dm1,
"incorrect old DocumentMgr returned\n");
2455 ITfDocumentMgr_Release(olddm);
2466 ITfDocumentMgr_Release(dm1);
2467 ITfDocumentMgr_Release(dm2);
2473 ITfThreadMgr_SetFocus(
g_tm,dmorig);
2495 ITfInputProcessorProfileMgr *ipp_mgr;
2498 hres = ITfInputProcessorProfiles_QueryInterface(
g_ipp, &IID_ITfInputProcessorProfileMgr, (
void**)&ipp_mgr);
2501 win_skip(
"ITfInputProcessorProfileMgr is not supported.\n");
2504 ok(
hres ==
S_OK,
"Could not get ITfInputProcessorProfileMgr iface: %08x\n",
hres);
2506 hres = ITfInputProcessorProfileMgr_EnumProfiles(ipp_mgr, 0, &enum_profiles);
2509 IEnumTfInputProcessorProfiles_Release(enum_profiles);
2511 ITfInputProcessorProfileMgr_Release(ipp_mgr);
2521 ok(
SUCCEEDED(
hr),
"Failed to initialize multi-threaded apartment\n");
2524 ok(
SUCCEEDED(
hr),
"Failed to create ITfThreadMgrEx instance\n");
2532 hr = ITfThreadMgrEx_QueryInterface(thmgr, &IID_ITfSource, (
LPVOID *)&
source);
2537 "Advise ITfUIElementSink should return marshalling failure: %08x\n",
hr);
2542 hr = ITfThreadMgrEx_Release(thmgr);
2565 ok(
ret == 0xdeadcafe,
"Thread terminated in an unexpected way\n");
2601 ITextStoreACPSink_Release(
ACPSink);
2602 ITfDocumentMgr_Release(
g_dm);
2605 skip(
"Unable to create InputProcessor\n");
#define InterlockedIncrement
#define InterlockedDecrement
const GUID IID_IClassFactory
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
#define HeapFree(x, y, z)
#define WideCharToMultiByte
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)
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
DWORD WINAPI GetTickCount(VOID)
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
HRESULT WINAPI CoCreateGuid(GUID *pguid)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
GLuint GLuint GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLsizei GLenum GLboolean sink
static DWORD DWORD void LPSTR DWORD cch
#define todo_wine_if(is_todo)
#define cmp(status, error)
EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles
EXTERN_C const CLSID CLSID_TF_ThreadMgr
EXTERN_C const GUID GUID_COMPARTMENT_EMPTYCONTEXT
EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_DISABLED
EXTERN_C const GUID GUID_COMPARTMENT_PERSISTMENUENABLED
EXTERN_C const GUID GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER
EXTERN_C const CLSID CLSID_TF_CategoryMgr
EXTERN_C const GUID GUID_COMPARTMENT_HANDWRITING_OPENCLOSE
EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_OPENCLOSE
EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD
EXTERN_C const GUID GUID_COMPARTMENT_KEYBOARD_DISABLED
EXTERN_C const GUID GUID_TFCAT_TIP_SPEECH
EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_GLOBALSTATE
EXTERN_C const GUID GUID_COMPARTMENT_KEYBOARD_OPENCLOSE
EXTERN_C const GUID GUID_COMPARTMENT_TIPUISTATUS
EXTERN_C const GUID GUID_TFCAT_TIP_HANDWRITING
static short search(int val, const short *table, int size)
#define CONNECT_E_ADVISELIMIT
#define CONNECT_E_NOCONNECTION
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IsEqualGUID(rguid1, rguid2)
#define IsEqualIID(riid1, riid2)
static __inline const char * wine_dbgstr_guid(const GUID *id)
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
void __winetest_cdecl winetest_trace(const char *msg,...)
IClassFactory IClassFactory_iface
ITfEditSession ITfEditSession_iface
ITfKeyEventSink ITfKeyEventSink_iface
ITfTextEditSink ITfTextEditSink_iface
ITfTextInputProcessor ITfTextInputProcessor_iface
ITextStoreACP ITextStoreACP_iface
ITfThreadMgrEventSink ITfThreadMgrEventSink_iface
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
const DWORD TS_SD_READONLY
TW_UINT32 TW_UINT16 TW_UINT16 MSG
#define CONTAINING_RECORD(address, type, field)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
#define REGDB_E_IIDNOTREG
#define CLASS_E_NOAGGREGATION
#define HKEY_LOCAL_MACHINE
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
BOOL WINAPI DestroyWindow(_In_ HWND)