Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d84de2c4
Commit
d84de2c4
authored
Jul 16, 2004
by
Krishna Murthy
Committed by
Alexandre Julliard
Jul 16, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added regression test for WM_NEXTDLGCTL and default button ID
behavior.
parent
51700afd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
165 additions
and
0 deletions
+165
-0
dialog.c
dlls/user/tests/dialog.c
+165
-0
No files found.
dlls/user/tests/dialog.c
View file @
d84de2c4
...
...
@@ -45,6 +45,8 @@ static int numwnds=1; /* 0 is reserved for null */
/* Global handles */
static
HINSTANCE
g_hinst
;
/* This application's HINSTANCE */
static
HWND
g_hwndMain
,
g_hwndButton1
,
g_hwndButton2
,
g_hwndButtonCancel
;
static
HWND
g_hwndTestDlg
,
g_hwndTestDlgBut1
,
g_hwndTestDlgBut2
,
g_hwndTestDlgEdit
;
static
int
g_terminated
;
typedef
struct
{
...
...
@@ -424,6 +426,37 @@ static BOOL OnMainWindowCreate (HWND hwnd, LPCREATESTRUCT lpcs)
}
/*
* OnTestDlgCreate
*/
static
BOOL
OnTestDlgCreate
(
HWND
hwnd
,
LPCREATESTRUCT
lpcs
)
{
g_hwndTestDlgEdit
=
CreateWindowEx
(
WS_EX_LEFT
|
WS_EX_LTRREADING
|
WS_EX_RIGHTSCROLLBAR
|
WS_EX_NOPARENTNOTIFY
|
WS_EX_CLIENTEDGE
,
TEXT
(
"Edit"
),
TEXT
(
"Edit"
),
WS_CHILDWINDOW
|
WS_VISIBLE
|
WS_TABSTOP
|
ES_LEFT
|
ES_AUTOHSCROLL
,
16
,
33
,
184
,
24
,
hwnd
,
(
HMENU
)
101
,
g_hinst
,
0
);
if
(
!
g_hwndTestDlgEdit
)
return
FALSE
;
g_hwndTestDlgBut1
=
CreateWindowEx
(
WS_EX_LEFT
|
WS_EX_LTRREADING
|
WS_EX_RIGHTSCROLLBAR
|
WS_EX_NOPARENTNOTIFY
,
TEXT
(
"button"
),
TEXT
(
"Button &1"
),
WS_CHILDWINDOW
|
WS_VISIBLE
|
WS_TABSTOP
|
BS_PUSHBUTTON
|
BS_TEXT
,
204
,
33
,
30
,
24
,
hwnd
,
(
HMENU
)
201
,
g_hinst
,
0
);
if
(
!
g_hwndTestDlgBut1
)
return
FALSE
;
g_hwndTestDlgBut2
=
CreateWindowEx
(
WS_EX_LEFT
|
WS_EX_LTRREADING
|
WS_EX_RIGHTSCROLLBAR
|
WS_EX_NOPARENTNOTIFY
,
TEXT
(
"button"
),
TEXT
(
"Button &2"
),
WS_CHILDWINDOW
|
WS_VISIBLE
|
WS_TABSTOP
|
BS_PUSHBUTTON
|
BS_TEXT
,
90
,
102
,
80
,
24
,
hwnd
,
(
HMENU
)
IDCANCEL
,
g_hinst
,
0
);
if
(
!
g_hwndTestDlgBut2
)
return
FALSE
;
return
TRUE
;
}
static
LRESULT
CALLBACK
main_window_procA
(
HWND
hwnd
,
UINT
uiMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
...
...
@@ -452,6 +485,26 @@ static LRESULT CALLBACK main_window_procA (HWND hwnd, UINT uiMsg, WPARAM wParam,
return
result
;
}
static
LRESULT
CALLBACK
testDlgWinProc
(
HWND
hwnd
,
UINT
uiMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
LRESULT
result
;
switch
(
uiMsg
)
{
/* Add blank case statements for these to ensure we don't use them
* by mistake.
*/
case
DM_GETDEFID
:
break
;
case
DM_SETDEFID
:
break
;
case
WM_CREATE
:
return
(
OnTestDlgCreate
(
hwnd
,
(
LPCREATESTRUCTA
)
lParam
)
?
0
:
(
LRESULT
)
-
1
);
}
result
=
DefWindowProcA
(
hwnd
,
uiMsg
,
wParam
,
lParam
);
return
result
;
}
static
BOOL
RegisterWindowClasses
(
void
)
{
...
...
@@ -475,9 +528,120 @@ static BOOL RegisterWindowClasses (void)
if
(
!
RegisterClassA
(
&
cls
))
return
FALSE
;
GetClassInfoA
(
0
,
"#32770"
,
&
cls
);
cls
.
lpfnWndProc
=
testDlgWinProc
;
cls
.
lpszClassName
=
"WM_NEXTDLGCTLWndClass"
;
if
(
!
RegisterClassA
(
&
cls
))
return
FALSE
;
return
TRUE
;
}
static
void
WM_NEXTDLGCTLTest
(
void
)
{
DWORD
dwVal
;
g_hwndTestDlg
=
CreateWindowEx
(
WS_EX_LEFT
|
WS_EX_LTRREADING
|
WS_EX_RIGHTSCROLLBAR
|
WS_EX_DLGMODALFRAME
|
WS_EX_WINDOWEDGE
|
WS_EX_CONTROLPARENT
|
WS_EX_APPWINDOW
,
"WM_NEXTDLGCTLWndClass"
,
"WM_NEXTDLGCTL Message test window"
,
WS_POPUPWINDOW
|
WS_CLIPSIBLINGS
|
WS_DLGFRAME
|
WS_OVERLAPPED
|
WS_MINIMIZEBOX
|
WS_MAXIMIZEBOX
|
DS_3DLOOK
|
DS_SETFONT
|
DS_MODALFRAME
,
0
,
0
,
235
,
135
,
NULL
,
NULL
,
g_hinst
,
0
);
assert
(
g_hwndTestDlg
);
assert
(
g_hwndTestDlgBut1
);
assert
(
g_hwndTestDlgBut2
);
assert
(
g_hwndTestDlgEdit
);
/*
* Test message DM_SETDEFID
*/
DefDlgProcA
(
g_hwndTestDlg
,
DM_SETDEFID
,
IDCANCEL
,
0
);
DefDlgProcA
(
g_hwndTestDlgBut1
,
BM_SETSTYLE
,
BS_DEFPUSHBUTTON
,
FALSE
);
dwVal
=
DefDlgProcA
(
g_hwndTestDlg
,
DM_GETDEFID
,
0
,
0
);
ok
(
IDCANCEL
==
(
LOWORD
(
dwVal
)),
"Did not set default ID"
);
/*
* Check whether message WM_NEXTDLGCTL is changing the focus to next control and if
* the destination control is a button, style of the button should be changed to
* BS_DEFPUSHBUTTON with out making it default.
*/
/*
* Keep the focus on Edit control.
*/
if
(
SetFocus
(
g_hwndTestDlgEdit
)
)
{
ok
((
GetFocus
()
==
g_hwndTestDlgEdit
),
"Focus didn't set on Edit control
\n
"
);
/*
* Test message WM_NEXTDLGCTL
*/
DefDlgProcA
(
g_hwndTestDlg
,
WM_NEXTDLGCTL
,
0
,
0
);
ok
((
GetFocus
()
==
g_hwndTestDlgBut1
),
"Focus didn't move to first button
\n
"
);
/*
* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL"
*/
dwVal
=
DefDlgProcA
(
g_hwndTestDlg
,
DM_GETDEFID
,
0
,
0
);
todo_wine
ok
(
IDCANCEL
==
(
LOWORD
(
dwVal
)),
"WM_NEXTDLGCTL changed default button
\n
"
);
/*
* Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
* the style of default button changed to BS_PUSHBUTTON.
*/
if
(
IDCANCEL
==
(
LOWORD
(
dwVal
))
)
{
ok
(
((
GetWindowLong
(
g_hwndTestDlgBut1
,
GWL_STYLE
))
&
BS_DEFPUSHBUTTON
),
"Button1 style not set to BS_DEFPUSHBUTTON
\n
"
);
ok
(
!
((
GetWindowLong
(
g_hwndTestDlgBut2
,
GWL_STYLE
))
&
BS_DEFPUSHBUTTON
),
"Button2's style not chaged to BS_PUSHBUTTON
\n
"
);
}
/*
* Move focus to Button2 using "WM_NEXTDLGCTL"
*/
DefDlgProcA
(
g_hwndTestDlg
,
WM_NEXTDLGCTL
,
0
,
0
);
ok
((
GetFocus
()
==
g_hwndTestDlgBut2
),
"Focus didn't move to second button
\n
"
);
/*
* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL"
*/
dwVal
=
DefDlgProcA
(
g_hwndTestDlg
,
DM_GETDEFID
,
0
,
0
);
ok
(
IDCANCEL
==
(
LOWORD
(
dwVal
)),
"WM_NEXTDLGCTL changed default button
\n
"
);
/*
* Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
* the style of button which lost the focus changed to BS_PUSHBUTTON.
*/
if
(
IDCANCEL
==
(
LOWORD
(
dwVal
))
)
{
todo_wine
ok
(
((
GetWindowLong
(
g_hwndTestDlgBut2
,
GWL_STYLE
))
&
BS_DEFPUSHBUTTON
),
"Button2 style not set to BS_DEFPUSHBUTTON
\n
"
);
ok
(
!
((
GetWindowLong
(
g_hwndTestDlgBut1
,
GWL_STYLE
))
&
BS_DEFPUSHBUTTON
),
"Button1's style not chaged to BS_PUSHBUTTON
\n
"
);
}
/*
* Move focus to Edit control using "WM_NEXTDLGCTL"
*/
DefDlgProcA
(
g_hwndTestDlg
,
WM_NEXTDLGCTL
,
0
,
0
);
ok
((
GetFocus
()
==
g_hwndTestDlgEdit
),
"Focus didn't move to Edit control
\n
"
);
/*
* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL"
*/
dwVal
=
DefDlgProcA
(
g_hwndTestDlg
,
DM_GETDEFID
,
0
,
0
);
todo_wine
ok
(
IDCANCEL
==
(
LOWORD
(
dwVal
)),
"WM_NEXTDLGCTL changed default button
\n
"
);
}
}
static
void
IsDialogMessageWTest
(
void
)
{
MSG
msg
;
...
...
@@ -515,4 +679,5 @@ START_TEST(dialog)
GetNextDlgItemTest
();
IsDialogMessageWTest
();
WM_NEXTDLGCTLTest
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment