2 * Unit tests for ITfInputProcessor
4 * Copyright 2009 Aric Stewart, CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/test.h"
32 static ITfInputProcessorProfiles* g_ipp;
33 static LANGID gLangid;
34 static ITfCategoryMgr * g_cm;
36 DEFINE_GUID(CLSID_FakeService, 0xEDE1A7AD,0x66DE,0x47E0,0xB6,0x20,0x3E,0x92,0xF8,0x24,0x6B,0xF3);
37 DEFINE_GUID(CLSID_TF_InputProcessorProfiles, 0x33c53a50,0xf456,0x4884,0xb0,0x49,0x85,0xfd,0x64,0x3e,0xcf,0xed);
38 DEFINE_GUID(CLSID_TF_CategoryMgr, 0xA4B544A1,0x438D,0x4B41,0x93,0x25,0x86,0x95,0x23,0xE2,0xD6,0xC7);
39 DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745c63,0xb2f0,0x4784,0x8b,0x67,0x5e,0x12,0xc8,0x70,0x1a,0x31);
40 DEFINE_GUID(GUID_TFCAT_TIP_SPEECH, 0xB5A73CD1,0x8355,0x426B,0xA1,0x61,0x25,0x98,0x08,0xF2,0x6B,0x14);
41 DEFINE_GUID(GUID_TFCAT_TIP_HANDWRITING, 0x246ecb87,0xc2f2,0x4abe,0x90,0x5b,0xc8,0xb3,0x8a,0xdd,0x2c,0x43);
42 DEFINE_GUID (GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER, 0x046B8C80,0x1647,0x40F7,0x9B,0x21,0xB9,0x3B,0x81,0xAA,0xBC,0x1B);
43 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
46 static HRESULT initialize(void)
50 hr = CoCreateInstance (&CLSID_TF_InputProcessorProfiles, NULL,
51 CLSCTX_INPROC_SERVER, &IID_ITfInputProcessorProfiles, (void**)&g_ipp);
53 hr = CoCreateInstance (&CLSID_TF_CategoryMgr, NULL,
54 CLSCTX_INPROC_SERVER, &IID_ITfCategoryMgr, (void**)&g_cm);
58 static void cleanup(void)
61 ITfInputProcessorProfiles_Release(g_ipp);
63 ITfCategoryMgr_Release(g_cm);
67 static void test_Register(void)
71 static const WCHAR szDesc[] = {'F','a','k','e',' ','W','i','n','e',' ','S','e','r','v','i','c','e',0};
72 static const WCHAR szFile[] = {'F','a','k','e',' ','W','i','n','e',' ','S','e','r','v','i','c','e',' ','F','i','l','e',0};
74 hr = ITfInputProcessorProfiles_Register(g_ipp, &CLSID_FakeService);
75 ok(SUCCEEDED(hr),"Unable to register text service(%x)\n",hr);
76 hr = ITfInputProcessorProfiles_AddLanguageProfile(g_ipp, &CLSID_FakeService, gLangid, &CLSID_FakeService, szDesc, sizeof(szDesc)/sizeof(WCHAR), szFile, sizeof(szFile)/sizeof(WCHAR), 1);
77 ok(SUCCEEDED(hr),"Unable to add Language Profile (%x)\n",hr);
80 static void test_Unregister(void)
83 hr = ITfInputProcessorProfiles_Unregister(g_ipp, &CLSID_FakeService);
84 ok(SUCCEEDED(hr),"Unable to unregister text service(%x)\n",hr);
87 static void test_EnumInputProcessorInfo(void)
92 if (SUCCEEDED(ITfInputProcessorProfiles_EnumInputProcessorInfo(g_ipp, &ppEnum)))
96 while (IEnumGUID_Next(ppEnum, 1, &g, &fetched) == S_OK)
98 if(IsEqualGUID(&g,&CLSID_FakeService))
102 ok(found,"Did not find registered text service\n");
105 static void test_RegisterCategory(void)
108 hr = ITfCategoryMgr_RegisterCategory(g_cm, &CLSID_FakeService, &GUID_TFCAT_TIP_KEYBOARD, &CLSID_FakeService);
109 ok(SUCCEEDED(hr),"ITfCategoryMgr_RegisterCategory failed\n");
112 static void test_UnregisterCategory(void)
115 hr = ITfCategoryMgr_UnregisterCategory(g_cm, &CLSID_FakeService, &GUID_TFCAT_TIP_KEYBOARD, &CLSID_FakeService);
116 todo_wine ok(SUCCEEDED(hr),"ITfCategoryMgr_UnregisterCategory failed\n");
119 START_TEST(inputprocessor)
121 if (SUCCEEDED(initialize()))
123 gLangid = GetUserDefaultLCID();
125 test_RegisterCategory();
126 test_EnumInputProcessorInfo();
127 test_UnregisterCategory();
131 skip("Unable to create InputProcessor\n");