ReactOS 0.4.16-dev-321-g63bb46a
himc.c File Reference
#include "precomp.h"
Include dependency graph for himc.c:

Go to the source code of this file.

Functions

static void Test1 (void)
 
static void Test2 (void)
 
 START_TEST (himc)
 

Function Documentation

◆ START_TEST()

START_TEST ( himc  )

Definition at line 191 of file himc.c.

192{
193 Test1();
194 Test2();
195}
static void Test1(void)
Definition: himc.c:10
static void Test2(void)
Definition: himc.c:156

◆ Test1()

static void Test1 ( void  )
static

Definition at line 10 of file himc.c.

11{
13 HWND hwndEdit, hwndStatic;
14 HIMC hNewIMC, hOldIMC, hIMC, hIMC1, hIMC2;
16
17 /* ImmCreateContext/ImmDestroyContext and ImmLockIMC/ImmUnlockIMC */
18 hNewIMC = ImmCreateContext();
19 ok(hNewIMC != NULL, "ImmCreateContext failed\n");
20 pIC = ImmLockIMC(hNewIMC);
21 ok(pIC == NULL, "ImmLockIMC succeeded unexpectedly\n");
22 ImmUnlockIMC(hNewIMC);
23 ok(ImmDestroyContext(hNewIMC), "ImmDestroyContext failed\n");
24
25 /* ImmGetContext against NULL */
26 hIMC = ImmGetContext(NULL);
27 ok(hIMC == NULL, "ImmGetContext failed\n");
28
29 /* Create EDIT control */
31 hwndEdit = CreateWindowW(L"EDIT", NULL, style, 0, 0, 100, 20, NULL, NULL,
33 ok(hwndEdit != NULL, "CreateWindowW failed\n");
34
35 /* Create STATIC control */
36 style = SS_LEFT;
37 hwndStatic = CreateWindowW(L"STATIC", NULL, style, 0, 30, 100, 20, NULL, NULL,
39 ok(hwndStatic != NULL, "CreateWindowW failed\n");
40
41 /* ImmGetContext/ImmReleaseContext and ImmLockIMC/ImmUnlockIMC */
42 hIMC1 = hIMC = ImmGetContext(hwndEdit);
43 ok(hIMC != NULL, "ImmGetContext failed\n");
44 pIC = ImmLockIMC(hIMC);
45 ok(pIC != NULL, "ImmLockIMC failed\n");
46 if (pIC != NULL)
47 {
48 ok(pIC->hWnd == NULL, "pIC->hWnd = %p\n", pIC->hWnd);
49 ok(!pIC->fOpen, "pIC->fOpen = %d\n", pIC->fOpen);
50 ok(ImmGetIMCCSize(pIC->hCompStr) != 0, "hCompStr size is 0\n");
51 ok(ImmGetIMCCSize(pIC->hCandInfo) != 0, "hCandInfo size is 0\n");
52 ok(ImmGetIMCCSize(pIC->hGuideLine) != 0, "hGuideLine size is 0\n");
53 ok(ImmGetIMCCSize(pIC->hPrivate) != 0, "hPrivate size is 0\n");
54 ok(ImmGetIMCCSize(pIC->hMsgBuf) != 0, "hMsgBuf size is 0\n");
55 }
56 else
57 {
58 skip("No pIC\n");
59 }
60 ImmUnlockIMC(hNewIMC);
62 pIC = ImmLockIMC(hIMC);
63 ok(pIC != NULL, "ImmLockIMC failed\n");
64 if (pIC != NULL)
65 {
66 ok(pIC->hWnd == hwndEdit, "pIC->hWnd = %p, expected %p\n", pIC->hWnd, hwndEdit);
67 ok(!pIC->fOpen, "pIC->fOpen = %d\n", pIC->fOpen);
68 }
69 else
70 {
71 skip("No pIC\n");
72 }
73 ImmUnlockIMC(hNewIMC);
75 pIC = ImmLockIMC(hIMC);
76 ok(pIC != NULL, "ImmLockIMC failed\n");
77 if (pIC != NULL)
78 {
79 ok(pIC->hWnd == hwndEdit, "pIC->hWnd = %p, expected %p\n", pIC->hWnd, hwndEdit);
80 }
81 else
82 {
83 skip("No pIC\n");
84 }
85 ImmUnlockIMC(hNewIMC);
86 ok(ImmSetOpenStatus(hIMC, TRUE), "ImmSetOpenStatus failed\n");
87 pIC = ImmLockIMC(hIMC);
88 ok(pIC != NULL, "ImmLockIMC failed\n");
89 if (pIC != NULL)
90 {
91 ok(pIC->fOpen, "pIC->fOpen = %d\n", pIC->fOpen);
92 }
93 else
94 {
95 skip("No pIC\n");
96 }
97 ImmUnlockIMC(hNewIMC);
98 ok(ImmReleaseContext(hwndEdit, hIMC), "ImmReleaseContext failed\n");
99
100 hIMC2 = hIMC = ImmGetContext(hwndStatic);
101 ok(hIMC != NULL, "ImmGetContext failed\n");
102 pIC = ImmLockIMC(hIMC);
103 ok(pIC != NULL, "ImmLockIMC failed\n");
104 if (pIC != NULL)
105 {
106 ok(pIC->hWnd == hwndEdit, "pIC->hWnd = %p, expected %p\n", pIC->hWnd, hwndEdit);
107 ok(ImmGetIMCCSize(pIC->hCompStr) != 0, "hCompStr size is 0\n");
108 ok(ImmGetIMCCSize(pIC->hCandInfo) != 0, "hCandInfo size is 0\n");
109 ok(ImmGetIMCCSize(pIC->hGuideLine) != 0, "hGuideLine size is 0\n");
110 ok(ImmGetIMCCSize(pIC->hPrivate) != 0, "hPrivate size is 0\n");
111 ok(ImmGetIMCCSize(pIC->hMsgBuf) != 0, "hMsgBuf size is 0\n");
112 }
113 else
114 {
115 skip("No pIC\n");
116 }
117 ImmUnlockIMC(hNewIMC);
118 ok(ImmReleaseContext(hwndEdit, hIMC), "ImmReleaseContext failed\n");
119
120 ok(hIMC1 == hIMC2, "hIMC1 = %p, expected %p\n", hIMC1, hIMC2);
121
122 /* ImmAssociateContext */
123 hNewIMC = ImmCreateContext();
124 ok(hNewIMC != NULL, "ImmCreateContext failed \n");
125 pIC = ImmLockIMC(hNewIMC);
126 ok(pIC != NULL, "ImmLockIMC failed\n");
127 ImmUnlockIMC(hNewIMC);
128 hOldIMC = ImmAssociateContext(hwndEdit, hNewIMC);
129 ok(hNewIMC != hOldIMC, "hNewIMC = %p, expected not %p\n", hNewIMC, hOldIMC);
130 hIMC = ImmGetContext(hwndEdit);
131 ok(hIMC == hNewIMC, "hIMC = %p, expected %p\n", hIMC, hNewIMC);
132 ok(hIMC != hOldIMC, "hIMC = %p, expected not %p\n", hIMC, hOldIMC);
133 pIC = ImmLockIMC(hNewIMC);
134 ok(pIC != NULL, "ImmLockIMC failed\n");
135 if (pIC != NULL)
136 {
137 ok(pIC->hWnd == NULL, "pIC->hWnd = %p\n", pIC->hWnd);
138 ok(ImmGetIMCCSize(pIC->hCompStr) != 0, "hCompStr size is 0\n");
139 ok(ImmGetIMCCSize(pIC->hCandInfo) != 0, "hCandInfo size is 0\n");
140 ok(ImmGetIMCCSize(pIC->hGuideLine) != 0, "hGuideLine size is 0\n");
141 ok(ImmGetIMCCSize(pIC->hPrivate) != 0, "hPrivate size is 0\n");
142 ok(ImmGetIMCCSize(pIC->hMsgBuf) != 0, "hMsgBuf size is 0\n");
143 }
144 else
145 {
146 skip("No pIC\n");
147 }
148 ImmUnlockIMC(hNewIMC);
149 ok(ImmReleaseContext(hwndEdit, hIMC), "ImmReleaseContext failed\n");
150 ok(ImmDestroyContext(hNewIMC), "ImmDestroyContext failed\n");
151
153 DestroyWindow(hwndStatic);
154}
Arabic default style
Definition: afstyles.h:94
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
HWND hwndEdit
Definition: combotst.c:65
DWORD HIMC
Definition: dimm.idl:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
Definition: ime.c:1466
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1067
HIMC WINAPI ImmCreateContext(void)
Definition: imm.c:591
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1045
BOOL WINAPI ImmDestroyContext(HIMC hIMC)
Definition: imm.c:916
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1086
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1058
HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:492
DWORD WINAPI ImmGetIMCCSize(HIMCC imcc)
Definition: utils.c:1236
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
unsigned long DWORD
Definition: ntddk_ex.h:95
#define L(x)
Definition: ntvdm.h:50
#define SS_LEFT
Definition: pedump.c:692
#define ES_LEFT
Definition: pedump.c:664
#define ES_MULTILINE
Definition: pedump.c:667
HIMCC hPrivate
Definition: immdev.h:144
HIMCC hMsgBuf
Definition: immdev.h:146
HIMCC hCompStr
Definition: immdev.h:141
HIMCC hCandInfo
Definition: immdev.h:142
HIMCC hGuideLine
Definition: immdev.h:143
HWND WINAPI SetFocus(_In_opt_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4319
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by InitTests(), START_TEST(), and SymlinkCreateTests().

◆ Test2()

static void Test2 ( void  )
static

Definition at line 156 of file himc.c.

157{
158 static const LPCSTR apszClasses[] =
159 {
160 "BUTTON",
161 "COMBOBOX",
162 "EDIT",
163 "LISTBOX",
164 "SCROLLBAR",
165 "STATIC"
166 };
167 size_t i;
168 HIMC hIMC;
169 HWND hwnd;
170
171 for (i = 0; i < _countof(apszClasses); ++i)
172 {
173 LPCSTR pszClass = apszClasses[i];
174 hwnd = CreateWindowA(pszClass, NULL, WS_VISIBLE, 0, 0, 0, 0, NULL, NULL,
176 ok(hwnd != NULL, "CreateWindow(%s) failed\n", pszClass);
177
178 hIMC = ImmGetContext(hwnd);
179
180 if (lstrcmpiA(pszClass, "BUTTON") == 0)
181 ok(hIMC == NULL, "hIMC was %p\n", hIMC);
182 else
183 ok(hIMC != NULL, "hIMC was NULL\n");
184
185 ImmReleaseContext(hwnd, hIMC);
186
188 }
189}
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4224
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define WS_VISIBLE
Definition: pedump.c:620
#define _countof(array)
Definition: sndvol32.h:70
#define GetModuleHandle
Definition: winbase.h:3852
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4318
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by START_TEST().