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
85a707e3
Commit
85a707e3
authored
Oct 04, 2004
by
Robert Shearman
Committed by
Alexandre Julliard
Oct 04, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for conversion of message parameters.
parent
7458de56
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
msg.c
dlls/user/tests/msg.c
+85
-0
No files found.
dlls/user/tests/msg.c
View file @
85a707e3
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include "winuser.h"
#include "winuser.h"
#include "wine/test.h"
#include "wine/test.h"
#include "wine/unicode.h"
#define MDI_FIRST_CHILD_ID 2004
#define MDI_FIRST_CHILD_ID 2004
...
@@ -2935,6 +2936,89 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
...
@@ -2935,6 +2936,89 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
return
CallNextHookEx
(
hCBT_hook
,
nCode
,
wParam
,
lParam
);
return
CallNextHookEx
(
hCBT_hook
,
nCode
,
wParam
,
lParam
);
}
}
static
const
WCHAR
wszUnicode
[]
=
{
'U'
,
'n'
,
'i'
,
'c'
,
'o'
,
'd'
,
'e'
,
0
};
static
const
WCHAR
wszAnsi
[]
=
{
'U'
,
0
};
static
LRESULT
CALLBACK
MsgConversionProcW
(
HWND
hwnd
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
uMsg
)
{
case
CB_FINDSTRINGEXACT
:
trace
(
"String: %p
\n
"
,
(
LPCWSTR
)
lParam
);
if
(
!
strcmpW
((
LPCWSTR
)
lParam
,
wszUnicode
))
return
1
;
if
(
!
strcmpW
((
LPCWSTR
)
lParam
,
wszAnsi
))
return
0
;
return
-
1
;
}
return
DefWindowProcW
(
hwnd
,
uMsg
,
wParam
,
lParam
);
}
static
void
test_message_conversion
(
void
)
{
static
const
WCHAR
wszMsgConversionClass
[]
=
{
'M'
,
's'
,
'g'
,
'C'
,
'o'
,
'n'
,
'v'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'C'
,
'l'
,
'a'
,
's'
,
's'
,
0
};
WNDCLASSW
cls
;
LRESULT
lRes
;
HWND
hwnd
;
WNDPROC
wndproc
;
cls
.
style
=
0
;
cls
.
lpfnWndProc
=
MsgConversionProcW
;
cls
.
cbClsExtra
=
0
;
cls
.
cbWndExtra
=
0
;
cls
.
hInstance
=
GetModuleHandleW
(
NULL
);
cls
.
hIcon
=
NULL
;
cls
.
hCursor
=
LoadCursorW
(
NULL
,
(
LPWSTR
)
IDC_ARROW
);
cls
.
hbrBackground
=
(
HBRUSH
)(
COLOR_BTNFACE
+
1
);
cls
.
lpszMenuName
=
NULL
;
cls
.
lpszClassName
=
wszMsgConversionClass
;
/* this call will fail on Win9x, but that doesn't matter as this test is
* meaningless on those platforms */
if
(
!
RegisterClassW
(
&
cls
))
return
;
hwnd
=
CreateWindowExW
(
0
,
wszMsgConversionClass
,
NULL
,
WS_OVERLAPPED
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
ok
(
hwnd
!=
NULL
,
"Window creation failed
\n
"
);
/* {W, A} -> A */
wndproc
=
(
WNDPROC
)
GetWindowLongPtrA
(
hwnd
,
GWLP_WNDPROC
);
lRes
=
CallWindowProcA
(
wndproc
,
hwnd
,
CB_FINDSTRINGEXACT
,
0
,
(
LPARAM
)
wszUnicode
);
ok
(
lRes
==
0
,
"String should have been converted
\n
"
);
lRes
=
CallWindowProcW
(
wndproc
,
hwnd
,
CB_FINDSTRINGEXACT
,
0
,
(
LPARAM
)
wszUnicode
);
ok
(
lRes
==
1
,
"String shouldn't have been converted
\n
"
);
/* {W, A} -> W */
wndproc
=
(
WNDPROC
)
GetWindowLongPtrW
(
hwnd
,
GWLP_WNDPROC
);
lRes
=
CallWindowProcA
(
wndproc
,
hwnd
,
CB_FINDSTRINGEXACT
,
0
,
(
LPARAM
)
wszUnicode
);
ok
(
lRes
==
1
,
"String shouldn't have been converted
\n
"
);
lRes
=
CallWindowProcW
(
wndproc
,
hwnd
,
CB_FINDSTRINGEXACT
,
0
,
(
LPARAM
)
wszUnicode
);
ok
(
lRes
==
1
,
"String shouldn't have been converted
\n
"
);
/* Synchronous messages */
lRes
=
SendMessageA
(
hwnd
,
CB_FINDSTRINGEXACT
,
0
,
(
LPARAM
)
wszUnicode
);
ok
(
lRes
==
0
,
"String should have been converted
\n
"
);
lRes
=
SendMessageW
(
hwnd
,
CB_FINDSTRINGEXACT
,
0
,
(
LPARAM
)
wszUnicode
);
ok
(
lRes
==
1
,
"String shouldn't have been converted
\n
"
);
/* Asynchronous messages */
todo_wine
{
SetLastError
(
0
);
lRes
=
PostMessageA
(
hwnd
,
CB_FINDSTRINGEXACT
,
0
,
(
LPARAM
)
wszUnicode
);
ok
(
lRes
==
0
&&
GetLastError
()
==
ERROR_MESSAGE_SYNC_ONLY
,
"PostMessage on sync only message returned %ld, last error %ld
\n
"
,
lRes
,
GetLastError
());
SetLastError
(
0
);
lRes
=
PostMessageW
(
hwnd
,
CB_FINDSTRINGEXACT
,
0
,
(
LPARAM
)
wszUnicode
);
ok
(
lRes
==
0
&&
GetLastError
()
==
ERROR_MESSAGE_SYNC_ONLY
,
"PostMessage on sync only message returned %ld, last error %ld
\n
"
,
lRes
,
GetLastError
());
}
}
START_TEST
(
msg
)
START_TEST
(
msg
)
{
{
if
(
!
RegisterWindowClasses
())
assert
(
0
);
if
(
!
RegisterWindowClasses
())
assert
(
0
);
...
@@ -2946,6 +3030,7 @@ START_TEST(msg)
...
@@ -2946,6 +3030,7 @@ START_TEST(msg)
test_mdi_messages
();
test_mdi_messages
();
test_button_messages
();
test_button_messages
();
test_paint_messages
();
test_paint_messages
();
test_message_conversion
();
UnhookWindowsHookEx
(
hCBT_hook
);
UnhookWindowsHookEx
(
hCBT_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