ReactOS  0.4.15-dev-1374-g8d3e80e
CreateDialog.c File Reference
#include "precomp.h"
Include dependency graph for CreateDialog.c:

Go to the source code of this file.

Classes

struct  tagMsgInfo
 
struct  tagMsgList
 

Macros

#define TEST_MAX_MSG   50
 
#define MSGLST_CMP_WP   0x1
 
#define MSGLST_CMP_LP   0x2
 
#define MSGLST_CMP_RES   0x4
 
#define MSGLST_CMP_ALL   (MSGLST_CMP_WP | MSGLST_CMP_LP | MSGLST_CMP_RES)
 

Functions

void DumpMsgList (const char *lstName, const tagMsgList *ml)
 
BOOL CmpMsgList (const tagMsgList *recvd, const tagMsgList *expect)
 
INT_PTR CALLBACK Test_CreateDialogW_DLGPROC (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK Test_CreateDialogW_WNDPROC (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
void Test_CreateDialogW ()
 
 START_TEST (CreateDialog)
 

Variables

tagMsgList msglist
 
const tagMsgList t1msgList
 

Macro Definition Documentation

◆ MSGLST_CMP_ALL

#define MSGLST_CMP_ALL   (MSGLST_CMP_WP | MSGLST_CMP_LP | MSGLST_CMP_RES)

Definition at line 16 of file CreateDialog.c.

◆ MSGLST_CMP_LP

#define MSGLST_CMP_LP   0x2

Definition at line 14 of file CreateDialog.c.

◆ MSGLST_CMP_RES

#define MSGLST_CMP_RES   0x4

Definition at line 15 of file CreateDialog.c.

◆ MSGLST_CMP_WP

#define MSGLST_CMP_WP   0x1

Definition at line 13 of file CreateDialog.c.

◆ TEST_MAX_MSG

#define TEST_MAX_MSG   50

Definition at line 10 of file CreateDialog.c.

Function Documentation

◆ CmpMsgList()

BOOL CmpMsgList ( const tagMsgList recvd,
const tagMsgList expect 
)

Definition at line 75 of file CreateDialog.c.

77 {
78  int i1;
79  BOOL isOk;
80 
81  isOk = TRUE;
82  if (recvd->msgCount != expect->msgCount)
83  {
84  ok(FALSE, "%d messages expected, %d messages received!\n",
85  expect->msgCount, recvd->msgCount);
86  isOk = FALSE;
87  }
88  else
89  {
90  for (i1 = 0; i1 < recvd->msgCount; i1++)
91  {
92  if (expect->msgList[i1].DlgProc != recvd->msgList[i1].DlgProc)
93  isOk = FALSE;
94  if (expect->msgList[i1].msg != recvd->msgList[i1].msg)
95  isOk = FALSE;
96  if ((expect->msgList[i1].cmpflag & MSGLST_CMP_WP) &&
97  (expect->msgList[i1].wParam != recvd->msgList[i1].wParam))
98  isOk = FALSE;
99  if ((expect->msgList[i1].cmpflag & MSGLST_CMP_LP) &&
100  (expect->msgList[i1].lParam != recvd->msgList[i1].lParam))
101  isOk = FALSE;
102  if ((expect->msgList[i1].cmpflag & MSGLST_CMP_RES) &&
103  (expect->msgList[i1].result != recvd->msgList[i1].result))
104  isOk = FALSE;
105  if (!isOk)
106  {
107  ok(FALSE, "Message #%.3d not equal\n", i1);
108  break;
109  }
110  }
111  }
112 
113  if (!isOk)
114  {
115  DumpMsgList("RECEIVED", recvd);
116  DumpMsgList("EXPECTED", expect);
117  return FALSE;
118  }
119 
120  ok(TRUE, "\n");
121  return TRUE;
122 }
#define TRUE
Definition: types.h:120
tagMsgInfo msgList[TEST_MAX_MSG]
Definition: CreateDialog.c:31
void DumpMsgList(const char *lstName, const tagMsgList *ml)
Definition: CreateDialog.c:56
#define MSGLST_CMP_RES
Definition: CreateDialog.c:15
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MSGLST_CMP_LP
Definition: CreateDialog.c:14
#define MSGLST_CMP_WP
Definition: CreateDialog.c:13
LPARAM lParam
Definition: CreateDialog.c:23
#define ok(value,...)
Definition: atltest.h:57
#define expect(expected, got)
Definition: combo.c:36
WPARAM wParam
Definition: CreateDialog.c:22
BOOL DlgProc
Definition: CreateDialog.c:20

Referenced by Test_CreateDialogW().

◆ DumpMsgList()

void DumpMsgList ( const char lstName,
const tagMsgList ml 
)

Definition at line 56 of file CreateDialog.c.

57 {
58  const char *dlgProcName;
59  int i1;
60 
61  printf("%s\n", lstName);
62  for (i1 = 0; i1 < ml->msgCount; i1++)
63  {
64  dlgProcName = (ml->msgList[i1].DlgProc) ? "DlgProc" : "WndProc";
65  printf("#%.3d %s, msg 0x%x, wParam 0x%Ix, lParam 0x%Ix, result %d\n",
66  i1,
67  dlgProcName,
68  ml->msgList[i1].msg,
69  ml->msgList[i1].wParam,
70  ml->msgList[i1].lParam,
71  ml->msgList[i1].result);
72  }
73 }
tagMsgInfo msgList[TEST_MAX_MSG]
Definition: CreateDialog.c:31
LPARAM lParam
Definition: CreateDialog.c:23
WPARAM wParam
Definition: CreateDialog.c:22
BOOL DlgProc
Definition: CreateDialog.c:20
#define printf
Definition: config.h:203

Referenced by CmpMsgList().

◆ START_TEST()

START_TEST ( CreateDialog  )

Definition at line 198 of file CreateDialog.c.

199 {
200  //Test_CreateDialogA();//TODO
202 }
void Test_CreateDialogW()
Definition: CreateDialog.c:159

◆ Test_CreateDialogW()

void Test_CreateDialogW ( )

Definition at line 159 of file CreateDialog.c.

160 {
161  HWND hWnd;
162  HMODULE hMod;
163  DWORD exstyle;
164  WNDCLASSW wc;
165 
166  hMod = GetModuleHandle(NULL);
167  ok(hMod != NULL, "\n");
168 
169  msglist.msgCount = 0;
170  wc.style = CS_HREDRAW | CS_VREDRAW;
172  wc.cbClsExtra = 0;
174  wc.hInstance = hMod;
177  wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
178  wc.lpszMenuName = NULL;
179  wc.lpszClassName = L"TestDialogClass";
180 
181  if (!RegisterClassW(&wc))
182  {
183  ok(FALSE, "Error registering Window-Class\n");
184  return;
185  }
186  hWnd = CreateDialogW(hMod, L"TESTDIALOG", 0, Test_CreateDialogW_DLGPROC);
187  ok(hWnd != NULL, "Error: %lu\n", GetLastError());
188  if (hWnd != NULL)
189  {
190  /* Check the exstyle */
191  exstyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
192  ok(exstyle != 0x50010, "ExStyle wrong, got %#08lX, expected 0x50010.\n", exstyle);
193  /* Check the messages we received during creation */
195  }
196 }
const tagMsgList t1msgList
Definition: CreateDialog.c:37
UINT style
Definition: winuser.h:3151
LPCWSTR lpszMenuName
Definition: winuser.h:3159
LRESULT CALLBACK Test_CreateDialogW_WNDPROC(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: CreateDialog.c:140
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define CS_HREDRAW
Definition: winuser.h:648
#define GWL_EXSTYLE
Definition: winuser.h:845
int cbClsExtra
Definition: winuser.h:3153
BOOL CmpMsgList(const tagMsgList *recvd, const tagMsgList *expect)
Definition: CreateDialog.c:75
#define IDI_APPLICATION
Definition: winuser.h:699
#define COLOR_WINDOW
Definition: winuser.h:908
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define FALSE
Definition: types.h:117
WNDPROC lpfnWndProc
Definition: winuser.h:3152
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
LPCWSTR lpszClassName
Definition: winuser.h:3160
#define CS_VREDRAW
Definition: winuser.h:653
int cbWndExtra
Definition: winuser.h:3154
unsigned long DWORD
Definition: ntddk_ex.h:95
HICON hIcon
Definition: winuser.h:3156
static const WCHAR L[]
Definition: oid.c:1250
#define DLGWINDOWEXTRA
Definition: winuser.h:2540
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4256
#define LoadCursor
Definition: winuser.h:5787
HCURSOR hCursor
Definition: winuser.h:3157
#define GetModuleHandle
Definition: winbase.h:3667
HBRUSH hbrBackground
Definition: winuser.h:3158
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
HINSTANCE hInstance
Definition: winuser.h:3155
#define IDC_ARROW
Definition: winuser.h:682
#define LoadIcon
Definition: winuser.h:5788
tagMsgList msglist
Definition: CreateDialog.c:34
INT_PTR CALLBACK Test_CreateDialogW_DLGPROC(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: CreateDialog.c:124

Referenced by START_TEST().

◆ Test_CreateDialogW_DLGPROC()

INT_PTR CALLBACK Test_CreateDialogW_DLGPROC ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 124 of file CreateDialog.c.

125 {
127  {
133  msglist.msgCount++;
134  }
135  trace("DlgProc: msg 0x%x, wParam 0x%x, lParam 0x%Ix\n",
136  msg, wParam, lParam);
137  return FALSE;
138 }
#define TRUE
Definition: types.h:120
tagMsgInfo msgList[TEST_MAX_MSG]
Definition: CreateDialog.c:31
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define trace
Definition: atltest.h:70
#define TEST_MAX_MSG
Definition: CreateDialog.c:10
LPARAM lParam
Definition: CreateDialog.c:23
#define msg(x)
Definition: auth_time.c:54
WPARAM wParam
Definition: CreateDialog.c:22
BOOL DlgProc
Definition: CreateDialog.c:20
tagMsgList msglist
Definition: CreateDialog.c:34
LPARAM lParam
Definition: combotst.c:139

Referenced by Test_CreateDialogW().

◆ Test_CreateDialogW_WNDPROC()

LRESULT CALLBACK Test_CreateDialogW_WNDPROC ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 140 of file CreateDialog.c.

141 {
142  LRESULT res;
144 
146  {
152  msglist.msgCount++;
153  }
154  trace("WndProc: msg 0x%x, wParam 0x%x, lParam 0x%Ix, result %Id\n",
155  msg, wParam, lParam, res);
156  return res;
157 }
HWND hWnd
Definition: settings.c:17
tagMsgInfo msgList[TEST_MAX_MSG]
Definition: CreateDialog.c:31
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define trace
Definition: atltest.h:70
LRESULT WINAPI DefDlgProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TEST_MAX_MSG
Definition: CreateDialog.c:10
LPARAM lParam
Definition: CreateDialog.c:23
#define msg(x)
Definition: auth_time.c:54
GLuint res
Definition: glext.h:9613
WPARAM wParam
Definition: CreateDialog.c:22
BOOL DlgProc
Definition: CreateDialog.c:20
tagMsgList msglist
Definition: CreateDialog.c:34
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Referenced by Test_CreateDialogW().

Variable Documentation

◆ msglist

◆ t1msgList

const tagMsgList t1msgList
Initial value:
=
{
11,
{
{ FALSE, WM_SIZE, 0, 0x145012c, 0, MSGLST_CMP_ALL },
{ FALSE, WM_MOVE, 0, 0x0160003, 0, MSGLST_CMP_WP | MSGLST_CMP_RES },
{ TRUE, WM_CHANGEUISTATE, 3, 0, 0, MSGLST_CMP_LP | MSGLST_CMP_RES },
{ FALSE, WM_CHANGEUISTATE, 3, 0, 0, MSGLST_CMP_LP | MSGLST_CMP_RES },
}
}
#define TRUE
Definition: types.h:120
#define WM_NCCALCSIZE
Definition: winuser.h:1667
#define WM_MOVE
Definition: winuser.h:1592
#define MSGLST_CMP_ALL
Definition: CreateDialog.c:16
#define WM_NCCREATE
Definition: winuser.h:1665
#define MSGLST_CMP_RES
Definition: CreateDialog.c:15
#define FALSE
Definition: types.h:117
#define MSGLST_CMP_LP
Definition: CreateDialog.c:14
#define MSGLST_CMP_WP
Definition: CreateDialog.c:13
#define WM_SIZE
Definition: winuser.h:1593
#define WM_SETFONT
Definition: winuser.h:1632
#define WM_CREATE
Definition: winuser.h:1590
#define WM_INITDIALOG
Definition: winuser.h:1721

Definition at line 37 of file CreateDialog.c.

Referenced by Test_CreateDialogW().