Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
7699d8e4
Commit
7699d8e4
authored
Mar 28, 2018
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Mar 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add BM_SETIMAGE style check tests.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
06d2ad29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
116 additions
and
0 deletions
+116
-0
msg.c
dlls/user32/tests/msg.c
+116
-0
No files found.
dlls/user32/tests/msg.c
View file @
7699d8e4
...
...
@@ -6502,6 +6502,121 @@ static void test_button_messages(void)
DestroyWindow
(
parent
);
}
static
void
test_button_bm_get_set_image
(
void
)
{
HWND
hwnd
;
HDC
hdc
;
HBITMAP
hbmp1x1
;
HBITMAP
hbmp2x2
;
HBITMAP
hmask2x2
;
ICONINFO
icon_info2x2
;
HICON
hicon2x2
;
HBITMAP
hbmp
;
HICON
hicon
;
ICONINFO
icon_info
;
BITMAP
bm
;
DWORD
default_style
=
BS_PUSHBUTTON
|
WS_TABSTOP
|
WS_POPUP
|
WS_VISIBLE
;
LRESULT
ret
;
hdc
=
GetDC
(
0
);
hbmp1x1
=
CreateCompatibleBitmap
(
hdc
,
1
,
1
);
hbmp2x2
=
CreateCompatibleBitmap
(
hdc
,
2
,
2
);
ZeroMemory
(
&
bm
,
sizeof
(
bm
));
ok
(
GetObjectW
(
hbmp1x1
,
sizeof
(
bm
),
&
bm
),
"Expect GetObjectW() success
\n
"
);
ok
(
bm
.
bmWidth
==
1
&&
bm
.
bmHeight
==
1
,
"Expect bitmap size: %d,%d, got: %d,%d
\n
"
,
1
,
1
,
bm
.
bmWidth
,
bm
.
bmHeight
);
ZeroMemory
(
&
bm
,
sizeof
(
bm
));
ok
(
GetObjectW
(
hbmp2x2
,
sizeof
(
bm
),
&
bm
),
"Expect GetObjectW() success
\n
"
);
ok
(
bm
.
bmWidth
==
2
&&
bm
.
bmHeight
==
2
,
"Expect bitmap size: %d,%d, got: %d,%d
\n
"
,
2
,
2
,
bm
.
bmWidth
,
bm
.
bmHeight
);
hmask2x2
=
CreateCompatibleBitmap
(
hdc
,
2
,
2
);
ZeroMemory
(
&
icon_info2x2
,
sizeof
(
icon_info2x2
));
icon_info2x2
.
fIcon
=
TRUE
;
icon_info2x2
.
hbmMask
=
hmask2x2
;
icon_info2x2
.
hbmColor
=
hbmp2x2
;
hicon2x2
=
CreateIconIndirect
(
&
icon_info2x2
);
ZeroMemory
(
&
icon_info
,
sizeof
(
icon_info
));
ok
(
GetIconInfo
(
hicon2x2
,
&
icon_info
),
"Expect GetIconInfo() success
\n
"
);
ZeroMemory
(
&
bm
,
sizeof
(
bm
));
ok
(
GetObjectW
(
icon_info
.
hbmColor
,
sizeof
(
bm
),
&
bm
),
"Expect GetObjectW() success
\n
"
);
ok
(
bm
.
bmWidth
==
2
&&
bm
.
bmHeight
==
2
,
"Expect bitmap size: %d,%d, got: %d,%d
\n
"
,
2
,
2
,
bm
.
bmWidth
,
bm
.
bmHeight
);
DeleteObject
(
icon_info
.
hbmColor
);
DeleteObject
(
icon_info
.
hbmMask
);
/* Set bitmap with BS_BITMAP */
hwnd
=
CreateWindowA
(
"Button"
,
"test"
,
default_style
|
BS_BITMAP
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
0
);
ok
(
hwnd
!=
NULL
,
"Expect hwnd not NULL
\n
"
);
SendMessageA
(
hwnd
,
BM_SETIMAGE
,
(
WPARAM
)
IMAGE_BITMAP
,
(
LPARAM
)
hbmp1x1
);
hbmp
=
(
HBITMAP
)
SendMessageA
(
hwnd
,
BM_GETIMAGE
,
(
WPARAM
)
IMAGE_BITMAP
,
0
);
ok
(
hbmp
!=
0
,
"Expect hbmp not 0
\n
"
);
ZeroMemory
(
&
bm
,
sizeof
(
bm
));
ok
(
GetObjectW
(
hbmp
,
sizeof
(
bm
),
&
bm
),
"Expect GetObjectW() success
\n
"
);
ok
(
bm
.
bmWidth
==
1
&&
bm
.
bmHeight
==
1
,
"Expect bitmap size: %d,%d, got: %d,%d
\n
"
,
1
,
1
,
bm
.
bmWidth
,
bm
.
bmHeight
);
DestroyWindow
(
hwnd
);
/* Set bitmap without BS_BITMAP */
hwnd
=
CreateWindowA
(
"Button"
,
"test"
,
default_style
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
0
);
ok
(
hwnd
!=
NULL
,
"Expect hwnd not NULL
\n
"
);
ret
=
SendMessageA
(
hwnd
,
BM_SETIMAGE
,
(
WPARAM
)
IMAGE_BITMAP
,
(
LPARAM
)
hbmp1x1
);
ok
(
ret
==
0
,
"Expect ret to be 0
\n
"
);
hbmp
=
(
HBITMAP
)
SendMessageA
(
hwnd
,
BM_GETIMAGE
,
(
WPARAM
)
IMAGE_BITMAP
,
0
);
ok
(
hbmp
==
NULL
,
"Expect hbmp to be NULL
\n
"
);
DestroyWindow
(
hwnd
);
/* Set icon with BS_ICON */
hwnd
=
CreateWindowA
(
"Button"
,
"test"
,
default_style
|
BS_ICON
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
0
);
ok
(
hwnd
!=
NULL
,
"Expect hwnd not NULL
\n
"
);
SendMessageA
(
hwnd
,
BM_SETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
(
LPARAM
)
hicon2x2
);
hicon
=
(
HICON
)
SendMessageA
(
hwnd
,
BM_GETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
0
);
ok
(
hicon
!=
NULL
,
"Expect hicon not NULL
\n
"
);
ZeroMemory
(
&
icon_info
,
sizeof
(
icon_info
));
ok
(
GetIconInfo
(
hicon
,
&
icon_info
),
"Expect GetIconInfo() success
\n
"
);
ZeroMemory
(
&
bm
,
sizeof
(
bm
));
ok
(
GetObjectW
(
icon_info
.
hbmColor
,
sizeof
(
bm
),
&
bm
),
"Expect GetObjectW() success
\n
"
);
ok
(
bm
.
bmWidth
==
2
&&
bm
.
bmHeight
==
2
,
"Expect bitmap size: %d,%d, got: %d,%d
\n
"
,
2
,
2
,
bm
.
bmWidth
,
bm
.
bmHeight
);
DeleteObject
(
icon_info
.
hbmColor
);
DeleteObject
(
icon_info
.
hbmMask
);
DestroyWindow
(
hwnd
);
/* Set icon without BS_ICON */
hwnd
=
CreateWindowA
(
"Button"
,
"test"
,
default_style
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
0
);
ok
(
hwnd
!=
NULL
,
"Expect hwnd not NULL
\n
"
);
ret
=
SendMessageA
(
hwnd
,
BM_SETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
(
LPARAM
)
hicon2x2
);
ok
(
ret
==
0
,
"Expect ret to be 0
\n
"
);
hicon
=
(
HICON
)
SendMessageA
(
hwnd
,
BM_GETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
0
);
ok
(
hicon
==
NULL
,
"Expect hicon to be NULL
\n
"
);
DestroyWindow
(
hwnd
);
/* Set icon with BS_BITMAP */
hwnd
=
CreateWindowA
(
"Button"
,
"test"
,
default_style
|
BS_BITMAP
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
0
);
ok
(
hwnd
!=
NULL
,
"Expect hwnd to be not NULL
\n
"
);
ret
=
SendMessageA
(
hwnd
,
BM_SETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
(
LPARAM
)
hicon2x2
);
ok
(
ret
==
0
,
"Expect ret to be 0
\n
"
);
hicon
=
(
HICON
)
SendMessageA
(
hwnd
,
BM_GETIMAGE
,
(
WPARAM
)
IMAGE_ICON
,
0
);
ok
(
hicon
==
NULL
,
"Expect hicon to be NULL
\n
"
);
DestroyWindow
(
hwnd
);
/* Set bitmap with BS_ICON */
hwnd
=
CreateWindowA
(
"Button"
,
"test"
,
default_style
|
BS_ICON
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
0
);
ok
(
hwnd
!=
NULL
,
"Expect hwnd to be not NULL
\n
"
);
ret
=
SendMessageA
(
hwnd
,
BM_SETIMAGE
,
(
WPARAM
)
IMAGE_BITMAP
,
(
LPARAM
)
hbmp1x1
);
ok
(
ret
==
0
,
"Expect ret to be 0
\n
"
);
hbmp
=
(
HBITMAP
)
SendMessageA
(
hwnd
,
BM_GETIMAGE
,
(
WPARAM
)
IMAGE_BITMAP
,
0
);
ok
(
hbmp
==
NULL
,
"Expect hbmp to be NULL
\n
"
);
DestroyWindow
(
hwnd
);
DestroyIcon
(
hicon2x2
);
DeleteObject
(
hmask2x2
);
DeleteObject
(
hbmp2x2
);
DeleteObject
(
hbmp1x1
);
ReleaseDC
(
0
,
hdc
);
}
/****************** static message test *************************/
static
const
struct
message
WmSetFontStaticSeq2
[]
=
{
...
...
@@ -16721,6 +16836,7 @@ START_TEST(msg)
invisible_parent_tests
();
test_mdi_messages
();
test_button_messages
();
test_button_bm_get_set_image
();
test_static_messages
();
test_listbox_messages
();
test_combobox_messages
();
...
...
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