ReactOS 0.4.15-dev-7942-gd23573b
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

static 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 MSGLST_CMP_RES
Definition: CreateDialog.c:15
#define MSGLST_CMP_WP
Definition: CreateDialog.c:13
void DumpMsgList(const char *lstName, const tagMsgList *ml)
Definition: CreateDialog.c:56
#define MSGLST_CMP_LP
Definition: CreateDialog.c:14
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
#define ok(value,...)
Definition: atltest.h:57
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
LPARAM lParam
Definition: CreateDialog.c:23
WPARAM wParam
Definition: CreateDialog.c:22
BOOL DlgProc
Definition: CreateDialog.c:20
tagMsgInfo msgList[TEST_MAX_MSG]
Definition: CreateDialog.c:31

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}
#define printf
Definition: freeldr.h:97

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;
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}
LRESULT CALLBACK Test_CreateDialogW_WNDPROC(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: CreateDialog.c:140
const tagMsgList t1msgList
Definition: CreateDialog.c:37
BOOL CmpMsgList(const tagMsgList *recvd, const tagMsgList *expect)
Definition: CreateDialog.c:75
INT_PTR CALLBACK Test_CreateDialogW_DLGPROC(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: CreateDialog.c:124
static tagMsgList msglist
Definition: CreateDialog.c:34
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
#define L(x)
Definition: ntvdm.h:50
LPCWSTR lpszClassName
Definition: winuser.h:3185
LPCWSTR lpszMenuName
Definition: winuser.h:3184
HBRUSH hbrBackground
Definition: winuser.h:3183
HICON hIcon
Definition: winuser.h:3181
HINSTANCE hInstance
Definition: winuser.h:3180
int cbClsExtra
Definition: winuser.h:3178
UINT style
Definition: winuser.h:3176
WNDPROC lpfnWndProc
Definition: winuser.h:3177
int cbWndExtra
Definition: winuser.h:3179
HCURSOR hCursor
Definition: winuser.h:3182
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetModuleHandle
Definition: winbase.h:3827
#define DLGWINDOWEXTRA
Definition: winuser.h:2565
#define CS_VREDRAW
Definition: winuser.h:658
#define COLOR_WINDOW
Definition: winuser.h:918
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define IDI_APPLICATION
Definition: winuser.h:704
#define LoadIcon
Definition: winuser.h:5813
#define LoadCursor
Definition: winuser.h:5812
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4281
#define GWL_EXSTYLE
Definition: winuser.h:851

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 {
134 }
135 trace("DlgProc: msg 0x%x, wParam 0x%x, lParam 0x%Ix\n",
136 msg, wParam, lParam);
137 return FALSE;
138}
#define TEST_MAX_MSG
Definition: CreateDialog.c:10
#define trace
Definition: atltest.h:70
#define msg(x)
Definition: auth_time.c:54
WPARAM wParam
Definition: combotst.c:138
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 {
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}
GLuint res
Definition: glext.h:9613
LONG_PTR LRESULT
Definition: windef.h:209
LRESULT WINAPI DefDlgProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by Test_CreateDialogW().

Variable Documentation

◆ msglist

tagMsgList msglist
static

◆ 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 MSGLST_CMP_ALL
Definition: CreateDialog.c:16
#define WM_CREATE
Definition: winuser.h:1608
#define WM_SIZE
Definition: winuser.h:1611
#define WM_INITDIALOG
Definition: winuser.h:1739
#define WM_NCCREATE
Definition: winuser.h:1683
#define WM_SETFONT
Definition: winuser.h:1650
#define WM_MOVE
Definition: winuser.h:1610
#define WM_NCCALCSIZE
Definition: winuser.h:1685

Definition at line 37 of file CreateDialog.c.

Referenced by Test_CreateDialogW().