msctf: Add tests for ITfCategoryMgr::UnregisterCategory and ITfCategoryMgr::RegisterCategory.

This commit is contained in:
Aric Stewart 2009-02-20 08:07:06 -06:00 committed by Alexandre Julliard
parent da8cdacf2f
commit cb2637fa5d
1 changed files with 29 additions and 0 deletions

View File

@ -31,9 +31,17 @@
static ITfInputProcessorProfiles* g_ipp; static ITfInputProcessorProfiles* g_ipp;
static LANGID gLangid; static LANGID gLangid;
static ITfCategoryMgr * g_cm;
DEFINE_GUID(CLSID_FakeService, 0xEDE1A7AD,0x66DE,0x47E0,0xB6,0x20,0x3E,0x92,0xF8,0x24,0x6B,0xF3); DEFINE_GUID(CLSID_FakeService, 0xEDE1A7AD,0x66DE,0x47E0,0xB6,0x20,0x3E,0x92,0xF8,0x24,0x6B,0xF3);
DEFINE_GUID(CLSID_TF_InputProcessorProfiles, 0x33c53a50,0xf456,0x4884,0xb0,0x49,0x85,0xfd,0x64,0x3e,0xcf,0xed); 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);
static HRESULT initialize(void) static HRESULT initialize(void)
{ {
@ -41,6 +49,9 @@ static HRESULT initialize(void)
CoInitialize(NULL); CoInitialize(NULL);
hr = CoCreateInstance (&CLSID_TF_InputProcessorProfiles, NULL, hr = CoCreateInstance (&CLSID_TF_InputProcessorProfiles, NULL,
CLSCTX_INPROC_SERVER, &IID_ITfInputProcessorProfiles, (void**)&g_ipp); CLSCTX_INPROC_SERVER, &IID_ITfInputProcessorProfiles, (void**)&g_ipp);
if (SUCCEEDED(hr))
hr = CoCreateInstance (&CLSID_TF_CategoryMgr, NULL,
CLSCTX_INPROC_SERVER, &IID_ITfCategoryMgr, (void**)&g_cm);
return hr; return hr;
} }
@ -48,6 +59,8 @@ static void cleanup(void)
{ {
if (g_ipp) if (g_ipp)
ITfInputProcessorProfiles_Release(g_ipp); ITfInputProcessorProfiles_Release(g_ipp);
if (g_cm)
ITfCategoryMgr_Release(g_cm);
CoUninitialize(); CoUninitialize();
} }
@ -71,12 +84,28 @@ static void test_Unregister(void)
ok(SUCCEEDED(hr),"Unable to unregister text service(%x)\n",hr); ok(SUCCEEDED(hr),"Unable to unregister text service(%x)\n",hr);
} }
static void test_RegisterCategory(void)
{
HRESULT hr;
hr = ITfCategoryMgr_RegisterCategory(g_cm, &CLSID_FakeService, &GUID_TFCAT_TIP_KEYBOARD, &CLSID_FakeService);
ok(SUCCEEDED(hr),"ITfCategoryMgr_RegisterCategory failed\n");
}
static void test_UnregisterCategory(void)
{
HRESULT hr;
hr = ITfCategoryMgr_UnregisterCategory(g_cm, &CLSID_FakeService, &GUID_TFCAT_TIP_KEYBOARD, &CLSID_FakeService);
todo_wine ok(SUCCEEDED(hr),"ITfCategoryMgr_UnregisterCategory failed\n");
}
START_TEST(inputprocessor) START_TEST(inputprocessor)
{ {
if (SUCCEEDED(initialize())) if (SUCCEEDED(initialize()))
{ {
gLangid = GetUserDefaultLCID(); gLangid = GetUserDefaultLCID();
test_Register(); test_Register();
test_RegisterCategory();
test_UnregisterCategory();
test_Unregister(); test_Unregister();
} }
else else