ReactOS 0.4.15-dev-7157-gb7dcc10
VirtualKey.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Tests for virtual keys
5 * COPYRIGHT: Copyright 2022 Stanislav Motylkov <x86corez@gmail.com>
6 */
7
8#include "precomp.h"
9
15#if (NTDDI_VERSION >= NTDDI_VISTA)
17#endif
18};
19
20struct
21{
25} TestCodes[] = {
26 {VK_TAB, 0, 15},
27 {VK_RETURN, 0, 28},
28 {VK_CONTROL, 0, 29},
31 {VK_MENU, 0, 56},
32 {VK_SPACE, 0, 57},
33};
34
35static void testMapVirtualKey()
36{
37 INT i;
38 UINT vCode, vExpect = 0;
39
40 /* Make sure MapVirtualKeyW returns 0 in all cases when uCode == 0 */
41 for (i = 0; i < _countof(MapTypes); i++)
42 {
43 vCode = MapVirtualKeyW(0, MapTypes[i]);
44 ok(vCode == vExpect, "[%d] Returned %u, expected %u\n", i, vCode, vExpect);
45 }
46
47 /* Test matching between virtual keys and scan codes */
48 for (i = 0; i < _countof(TestCodes); i++)
49 {
51 vExpect = TestCodes[i].ScanCode;
52 ok(vCode == vExpect, "[%d] ScanCode = %u, expected %u\n", i, vCode, vExpect);
53
55 vExpect = (TestCodes[i].ScanToVirt == 0 ? TestCodes[i].VirtKey : TestCodes[i].ScanToVirt);
56 ok(vCode == vExpect, "[%d] VirtKey = %u, expected %u\n", i, vCode, vExpect);
57 }
58}
59
60START_TEST(VirtualKey)
61{
63}
static void testMapVirtualKey()
Definition: VirtualKey.c:35
UINT ScanCode
Definition: VirtualKey.c:24
UINT ScanToVirt
Definition: VirtualKey.c:23
struct @1589 TestCodes[]
UINT MapTypes[]
Definition: VirtualKey.c:10
UINT VirtKey
Definition: VirtualKey.c:22
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
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
unsigned int UINT
Definition: ndis.h:50
#define _countof(array)
Definition: sndvol32.h:68
int32_t INT
Definition: typedefs.h:58
#define VK_TAB
Definition: winuser.h:2198
#define VK_SPACE
Definition: winuser.h:2218
#define MAPVK_VSC_TO_VK_EX
Definition: winuser.h:2357
#define VK_CONTROL
Definition: winuser.h:2202
#define VK_LCONTROL
Definition: winuser.h:2283
#define MAPVK_VSC_TO_VK
Definition: winuser.h:2355
#define VK_RCONTROL
Definition: winuser.h:2284
UINT WINAPI MapVirtualKeyW(_In_ UINT, _In_ UINT)
#define VK_RETURN
Definition: winuser.h:2200
#define MAPVK_VK_TO_CHAR
Definition: winuser.h:2356
#define MAPVK_VK_TO_VSC
Definition: winuser.h:2354
#define MAPVK_VK_TO_VSC_EX
Definition: winuser.h:2358
#define VK_MENU
Definition: winuser.h:2203