ReactOS  0.4.14-dev-297-g23e575c
RealGetWindowClass.c File Reference
#include "precomp.h"
Include dependency graph for RealGetWindowClass.c:

Go to the source code of this file.

Classes

struct  _TestData
 

Typedefs

typedef struct _TestData TestData
 

Functions

void Test_ClassAtoms ()
 
void Test_RealGetWindowClass ()
 
 START_TEST (RealGetWindowClass)
 

Variables

static PWSTR ControlsList []
 
static TestData RealClassTestData []
 

Typedef Documentation

◆ TestData

Function Documentation

◆ START_TEST()

START_TEST ( RealGetWindowClass  )

Definition at line 182 of file RealGetWindowClass.c.

183 {
184  Test_ClassAtoms();
186 }
void Test_ClassAtoms()
void Test_RealGetWindowClass()

◆ Test_ClassAtoms()

void Test_ClassAtoms ( )

Definition at line 81 of file RealGetWindowClass.c.

82 {
83  ATOM atom;
84  int i;
85  WNDCLASSW cls;
86 
87  // Initialize starting Atom number.
88  atom = GetClassInfoW(NULL, ControlsList[0], &cls);
89  if (!atom)
90  {
91  skip( "No reference Atom\n" );
92  return;
93  }
94 
95  trace("First Control Class Atom 0x%x\n",atom);
96 
97  for (i = 0; i < 17; atom++ ,i++)
98  {
99  if (lstrcmpW(ControlsList[i],L"\0"))
100  {
101  ATOM test_atom = GetClassInfoW(NULL, ControlsList[i], &cls);
102  // Skip unregistered Classes.
103  if (test_atom)
104  {
105  ok(test_atom == atom, "%S class atom did not match %x:%x\n",ControlsList[i],test_atom,atom);
106  ok(!lstrcmpW(cls.lpszClassName,ControlsList[i]),"GetClassName returned incorrect name\n");
107  }
108  }
109  }
110 }
WORD ATOM
Definition: dimm.idl:113
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
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
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetClassInfoW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSW)
LPCWSTR lpszClassName
Definition: winuser.h:3159
#define trace
Definition: atltest.h:70
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
static PWSTR ControlsList[]

Referenced by START_TEST().

◆ Test_RealGetWindowClass()

void Test_RealGetWindowClass ( )

Definition at line 112 of file RealGetWindowClass.c.

113 {
114  int testNo;
115  UINT Result;
116  CHAR Buffer[1024];
117 
119  ok(Result == 0, "Result = %d\n", Result);
120  ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "GetLastError() = %ld\n", GetLastError());
121 
122  for (testNo = 0; testNo < ARRAY_SIZE(RealClassTestData); testNo++)
123  {
124  ATOM atom;
125  WNDCLASSA cls;
126  HWND hWnd;
127 
128  /* Register classes, "derived" from built-in dialog, with and without the DLGWINDOWEXTRA flag set */
129  GetClassInfoA(0, "#32770", &cls);
130  if (RealClassTestData[testNo].OverrideWndProc)
132  cls.lpszClassName = RealClassTestData[testNo].ClassName;
133  cls.cbWndExtra &= ~RealClassTestData[testNo].WndExtra;
134  atom = RegisterClassA (&cls);
135  if (atom == 0) return;
136 
137  /* Create a window */
140  RealClassTestData[testNo].ClassName,
141  RealClassTestData[testNo].ClassName,
144  CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
145  NULL, NULL, 0, 0);
146 
147  /* Do we expect a HWND at all? */
148  if (RealClassTestData[testNo].ExpectsHwnd)
149  {
150  ok(hWnd != NULL, "\n");
151 
152  if (hWnd != NULL)
153  {
154  /* Get the "real" class name */
156  printf("Buffer: %s\nExpectedClassNameBefore(%d): %s\n", Buffer, testNo, RealClassTestData[testNo].ExpectedClassNameBefore);
157  ok( Result != 0, "\n" );
158  ok( strcmp( Buffer, RealClassTestData[testNo].ExpectedClassNameBefore ) == 0, "\n" );
159 
160  /* Call a function that requires a dialog window */
162 
163  /* Get the "real" class name again */
165  printf("Buffer: %s\nExpectedClassNameAfter(%d): %s\n", Buffer, testNo, RealClassTestData[testNo].ExpectedClassNameAfter);
166  ok( Result != 0, "\n" );
167  ok( strcmp( Buffer, RealClassTestData[testNo].ExpectedClassNameAfter ) == 0, "\n" );
168  }
169  }
170  else
171  {
172  ok(hWnd == NULL, "\n");
173  }
174 
175  /* Cleanup */
177  UnregisterClass(RealClassTestData[testNo].ClassName, 0);
178  }
179 
180 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_POPUPWINDOW
Definition: pedump.c:638
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
WORD ATOM
Definition: dimm.idl:113
#define WS_EX_LTRREADING
Definition: winuser.h:393
LRESULT WINAPI DefDlgProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
char CHAR
Definition: xmlstorage.h:175
HWND hWnd
Definition: settings.c:17
#define WS_DLGFRAME
Definition: pedump.c:626
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define DM_SETDEFID
Definition: winuser.h:2081
BOOL WINAPI DestroyWindow(_In_ HWND)
#define DS_MODALFRAME
Definition: winuser.h:375
int cbWndExtra
Definition: winuser.h:3140
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
BOOL WINAPI GetClassInfoA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSA)
#define CreateWindowEx
Definition: winuser.h:5656
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
#define WS_EX_LEFT
Definition: winuser.h:391
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define WS_OVERLAPPED
Definition: pedump.c:615
#define DS_SETFONT
Definition: winuser.h:378
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3146
static TestData RealClassTestData[]
#define WS_EX_RIGHTSCROLLBAR
Definition: winuser.h:401
#define DS_3DLOOK
Definition: winuser.h:367
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define RealGetWindowClass
Definition: winuser.h:5736
WNDPROC lpfnWndProc
Definition: winuser.h:3138
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define IDCANCEL
Definition: winuser.h:825
#define UnregisterClass
Definition: winuser.h:5762
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define printf
Definition: config.h:203

Referenced by START_TEST().

Variable Documentation

◆ ControlsList

PWSTR ControlsList[]
static
Initial value:
=
{
L"Button\0",
L"Edit\0",
L"Static\0",
L"ListBox\0",
L"ScrollBar\0",
L"ComboBox\0",
L"MDIClient\0",
L"ComboLBox\0",
L"DDEMLEvent\0",
L"DDEMLMom\0",
L"DMGClass\0",
L"DDEMLAnsiClient\0",
L"DDEMLUnicodeClient\0",
L"DDEMLAnsiServer\0",
L"DDEMLUnicodeServer\0",
L"IME\0",
L"\0",
}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 10 of file RealGetWindowClass.c.

Referenced by Test_ClassAtoms().

◆ RealClassTestData

TestData RealClassTestData[]
static

Definition at line 41 of file RealGetWindowClass.c.

Referenced by Test_RealGetWindowClass().