diff --git a/configure b/configure index 5a91b4e7663..fc0362f59b3 100755 --- a/configure +++ b/configure @@ -25827,6 +25827,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS dlls/msctf/Makefile: dlls/msctf/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/msctf/Makefile" +ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/msctf/tests/Makefile" +test "x$enable_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \\ + msctf/tests" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/msctf/tests/Makefile: dlls/msctf/tests/Makefile.in dlls/Maketest.rules" +ac_config_files="$ac_config_files dlls/msctf/tests/Makefile" + ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/msdmo/Makefile" test "x$enable_msdmo" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ @@ -28794,6 +28802,7 @@ do "dlls/mscms/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mscms/tests/Makefile" ;; "dlls/mscoree/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mscoree/Makefile" ;; "dlls/msctf/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msctf/Makefile" ;; + "dlls/msctf/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msctf/tests/Makefile" ;; "dlls/msdmo/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msdmo/Makefile" ;; "dlls/msftedit/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msftedit/Makefile" ;; "dlls/msg711.acm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msg711.acm/Makefile" ;; diff --git a/configure.ac b/configure.ac index d1c8d7a0976..e1e98fa0cf3 100644 --- a/configure.ac +++ b/configure.ac @@ -2059,6 +2059,7 @@ WINE_CONFIG_MAKEFILE([dlls/mscms/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_ WINE_CONFIG_MAKEFILE([dlls/mscms/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/mscoree/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/msctf/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/msctf/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/msdmo/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/msftedit/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/msg711.acm/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) diff --git a/dlls/msctf/tests/Makefile.in b/dlls/msctf/tests/Makefile.in new file mode 100644 index 00000000000..669f5a1b33d --- /dev/null +++ b/dlls/msctf/tests/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = msctf.dll +IMPORTS = uuid ole32 user32 kernel32 + +CTESTS = \ + inputprocessor.c + +@MAKE_TEST_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c new file mode 100644 index 00000000000..200a0d421cf --- /dev/null +++ b/dlls/msctf/tests/inputprocessor.c @@ -0,0 +1,84 @@ +/* + * Unit tests for ITfInputProcessor + * + * Copyright 2009 Aric Stewart, CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#define COBJMACROS +#include "wine/test.h" +#include "winuser.h" +#include "shlwapi.h" +#include "shlguid.h" +#include "comcat.h" +#include "initguid.h" +#include "msctf.h" + +static ITfInputProcessorProfiles* g_ipp; +static LANGID gLangid; + +DEFINE_GUID(CLSID_FakeService, 0xEDE1A7AD,0x66DE,0x47E0,0xB6,0x20,0x3E,0x92,0xF8,0x24,0x6B,0xF3); + +static HRESULT initialize(void) +{ + HRESULT hr; + CoInitialize(NULL); + hr = CoCreateInstance (&CLSID_TF_InputProcessorProfiles, NULL, + CLSCTX_INPROC_SERVER, &IID_ITfInputProcessorProfiles, (void**)&g_ipp); + return hr; +} + +static void cleanup(void) +{ + if (g_ipp) + ITfInputProcessorProfiles_Release(g_ipp); + CoUninitialize(); +} + +static void test_Register(void) +{ + HRESULT hr; + + static const WCHAR szDesc[] = {'F','a','k','e',' ','W','i','n','e',' ','S','e','r','v','i','c','e',0}; + static const WCHAR szFile[] = {'F','a','k','e',' ','W','i','n','e',' ','S','e','r','v','i','c','e',' ','F','i','l','e',0}; + + hr = ITfInputProcessorProfiles_Register(g_ipp, &CLSID_FakeService); + ok(SUCCEEDED(hr),"Unable to register text service(%x)\n",hr); + hr = ITfInputProcessorProfiles_AddLanguageProfile(g_ipp, &CLSID_FakeService, gLangid, &CLSID_FakeService, szDesc, sizeof(szDesc)/sizeof(WCHAR), szFile, sizeof(szFile)/sizeof(WCHAR), 1); + ok(SUCCEEDED(hr),"Unable to add Language Profile (%x)\n",hr); +} + +static void test_Unregister(void) +{ + HRESULT hr; + hr = ITfInputProcessorProfiles_Unregister(g_ipp, &CLSID_FakeService); + todo_wine ok(SUCCEEDED(hr),"Unable to unregister text service(%x)\n",hr); +} + +START_TEST(inputprocessor) +{ + if (SUCCEEDED(initialize())) + { + gLangid = GetUserDefaultLCID(); + test_Register(); + test_Unregister(); + } + else + skip("Unable to create InputProcessor\n"); + cleanup(); +}