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
adf77c1a
Commit
adf77c1a
authored
Aug 29, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
Aug 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Test more flags for MessageBox.
parent
b4280a48
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
28 deletions
+44
-28
dialog.c
dlls/user32/tests/dialog.c
+44
-28
No files found.
dlls/user32/tests/dialog.c
View file @
adf77c1a
...
...
@@ -2123,15 +2123,36 @@ static void test_timer_message(void)
DialogBoxA
(
g_hinst
,
"RADIO_TEST_DIALOG"
,
NULL
,
timer_message_dlg_proc
);
}
static
unsigned
int
msgbox_hook_proc_called
;
static
UINT
msgbox_type
;
static
LRESULT
CALLBACK
msgbox_hook_proc
(
INT
code
,
WPARAM
wParam
,
LPARAM
lParam
)
{
static
const
LONG
considered_ex_styles
=
WS_EX_CONTROLPARENT
|
WS_EX_WINDOWEDGE
|
WS_EX_DLGMODALFRAME
|
WS_EX_TOPMOST
;
if
(
code
==
HCBT_ACTIVATE
)
{
HWND
msgbox
=
(
HWND
)
wParam
,
msghwnd
;
LONG
exstyles
,
expected_exstyles
;
BOOL
system_modal
;
char
text
[
64
];
if
(
msgbox
)
{
exstyles
=
GetWindowLongA
(
msgbox
,
GWL_EXSTYLE
)
&
considered_ex_styles
;
++
msgbox_hook_proc_called
;
system_modal
=
msgbox_type
&
MB_SYSTEMMODAL
&&
!
(
msgbox_type
&
MB_TASKMODAL
);
expected_exstyles
=
WS_EX_CONTROLPARENT
|
WS_EX_WINDOWEDGE
;
if
((
msgbox_type
&
MB_TOPMOST
)
||
system_modal
)
expected_exstyles
|=
WS_EX_TOPMOST
;
if
(
!
system_modal
)
expected_exstyles
|=
WS_EX_DLGMODALFRAME
;
todo_wine_if
((
system_modal
&&
exstyles
==
(
expected_exstyles
|
WS_EX_DLGMODALFRAME
))
||
(
!
system_modal
&&
msgbox_type
&
MB_TOPMOST
))
ok
(
exstyles
==
expected_exstyles
,
"got %#lx, expected %#lx
\n
"
,
exstyles
,
expected_exstyles
);
text
[
0
]
=
0
;
GetWindowTextA
(
msgbox
,
text
,
sizeof
(
text
));
ok
(
!
strcmp
(
text
,
"MSGBOX caption"
),
"Unexpected window text
\"
%s
\"\n
"
,
text
);
...
...
@@ -2141,26 +2162,9 @@ static LRESULT CALLBACK msgbox_hook_proc(INT code, WPARAM wParam, LPARAM lParam)
text
[
0
]
=
0
;
GetWindowTextA
(
msghwnd
,
text
,
sizeof
(
text
));
ok
(
!
strcmp
(
text
,
"Text"
),
"Unexpected window text
\"
%s
\"\n
"
,
text
);
SendDlgItemMessageA
(
msgbox
,
IDCANCEL
,
WM_LBUTTONDOWN
,
0
,
0
);
SendDlgItemMessageA
(
msgbox
,
IDCANCEL
,
WM_LBUTTONUP
,
0
,
0
);
}
}
return
CallNextHookEx
(
NULL
,
code
,
wParam
,
lParam
);
}
static
LRESULT
CALLBACK
msgbox_sysmodal_hook_proc
(
INT
code
,
WPARAM
wParam
,
LPARAM
lParam
)
{
if
(
code
==
HCBT_ACTIVATE
)
{
HWND
msgbox
=
(
HWND
)
wParam
;
LONG
exstyles
=
GetWindowLongA
(
msgbox
,
GWL_EXSTYLE
);
if
(
msgbox
)
{
ok
(
exstyles
&
WS_EX_TOPMOST
,
"expected message box to have topmost exstyle set
\n
"
);
todo_wine_if
(
msgbox_type
!=
MB_OKCANCEL
&&
!*
text
)
ok
(
!
strcmp
(
text
,
"Text"
),
"Unexpected window text
\"
%s
\"\n
"
,
text
);
SendDlgItemMessageA
(
msgbox
,
IDCANCEL
,
WM_LBUTTONDOWN
,
0
,
0
);
SendDlgItemMessageA
(
msgbox
,
IDCANCEL
,
WM_LBUTTONUP
,
0
,
0
);
...
...
@@ -2172,20 +2176,32 @@ static LRESULT CALLBACK msgbox_sysmodal_hook_proc(INT code, WPARAM wParam, LPARA
static
void
test_MessageBox
(
void
)
{
static
const
UINT
tests
[]
=
{
MB_OKCANCEL
,
MB_OKCANCEL
|
MB_SYSTEMMODAL
,
MB_OKCANCEL
|
MB_TASKMODAL
|
MB_SYSTEMMODAL
,
MB_OKCANCEL
|
MB_TOPMOST
,
MB_OKCANCEL
|
MB_TOPMOST
|
MB_SYSTEMMODAL
,
MB_OKCANCEL
|
MB_TASKMODAL
|
MB_TOPMOST
,
MB_OKCANCEL
|
MB_TASKMODAL
|
MB_SYSTEMMODAL
|
MB_TOPMOST
,
};
unsigned
int
i
;
HHOOK
hook
;
int
ret
;
hook
=
SetWindowsHookExA
(
WH_CBT
,
msgbox_hook_proc
,
NULL
,
GetCurrentThreadId
());
ret
=
MessageBoxA
(
NULL
,
"Text"
,
"MSGBOX caption"
,
MB_OKCANCEL
);
ok
(
ret
==
IDCANCEL
,
"got %d
\n
"
,
ret
);
UnhookWindowsHookEx
(
hook
);
/* Test for MB_SYSTEMMODAL */
hook
=
SetWindowsHookExA
(
WH_CBT
,
msgbox_sysmodal_hook_proc
,
NULL
,
GetCurrentThreadId
());
MessageBoxA
(
NULL
,
NULL
,
"system modal"
,
MB_OKCANCEL
|
MB_SYSTEMMODAL
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
++
i
)
{
msgbox_type
=
tests
[
i
];
winetest_push_context
(
"type %#x"
,
msgbox_type
);
msgbox_hook_proc_called
=
0
;
ret
=
MessageBoxA
(
NULL
,
"Text"
,
"MSGBOX caption"
,
msgbox_type
);
ok
(
ret
==
IDCANCEL
,
"got %d
\n
"
,
ret
);
ok
(
msgbox_hook_proc_called
,
"got %u.
\n
"
,
msgbox_hook_proc_called
);
winetest_pop_context
();
}
UnhookWindowsHookEx
(
hook
);
}
...
...
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