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
2df7f6a3
Commit
2df7f6a3
authored
Aug 27, 2008
by
Jim Cameron
Committed by
Alexandre Julliard
Aug 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add a regression test for CreateIconFromResource.
parent
08775c64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
0 deletions
+94
-0
cursoricon.c
dlls/user32/tests/cursoricon.c
+94
-0
No files found.
dlls/user32/tests/cursoricon.c
View file @
2df7f6a3
...
...
@@ -851,6 +851,99 @@ static void test_LoadImage(void)
test_LoadImageFile
(
pngimage
,
sizeof
(
pngimage
),
"png"
,
0
);
}
static
void
test_CreateIconFromResource
(
void
)
{
HANDLE
handle
;
BOOL
ret
;
DWORD
error
;
BITMAPINFOHEADER
*
icon_header
;
INT16
*
hotspot
;
ICONINFO
icon_info
;
#define ICON_RES_WIDTH 32
#define ICON_RES_HEIGHT 32
#define ICON_RES_AND_SIZE (ICON_WIDTH*ICON_HEIGHT/8)
#define ICON_RES_BPP 32
#define ICON_RES_SIZE \
(sizeof(BITMAPINFOHEADER) + ICON_AND_SIZE + ICON_AND_SIZE*ICON_BPP)
#define CRSR_RES_SIZE (2*sizeof(INT16) + ICON_RES_SIZE)
/* Set icon data. */
hotspot
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
CRSR_RES_SIZE
);
/* Cursor resources have an extra hotspot, icon resources not. */
hotspot
[
0
]
=
3
;
hotspot
[
1
]
=
3
;
icon_header
=
(
BITMAPINFOHEADER
*
)
(
hotspot
+
2
);
icon_header
->
biSize
=
sizeof
(
BITMAPINFOHEADER
);
icon_header
->
biWidth
=
ICON_WIDTH
;
icon_header
->
biHeight
=
ICON_HEIGHT
*
2
;
icon_header
->
biPlanes
=
1
;
icon_header
->
biBitCount
=
ICON_BPP
;
icon_header
->
biSizeImage
=
0
;
/* Uncompressed bitmap. */
/* Test creating a cursor. */
SetLastError
(
0xdeadbeef
);
handle
=
CreateIconFromResource
((
PBYTE
)
hotspot
,
CRSR_RES_SIZE
,
FALSE
,
0x00030000
);
ok
(
handle
!=
NULL
,
"Create cursor failed.
\n
"
);
/* Test the icon information. */
SetLastError
(
0xdeadbeef
);
ret
=
GetIconInfo
(
handle
,
&
icon_info
);
ok
(
ret
,
"GetIconInfo() failed.
\n
"
);
error
=
GetLastError
();
ok
(
error
==
0xdeadbeef
,
"Last error: %u
\n
"
,
error
);
if
(
ret
)
{
ok
(
icon_info
.
fIcon
==
FALSE
,
"fIcon != FALSE.
\n
"
);
ok
(
icon_info
.
xHotspot
==
3
,
"xHotspot is %u.
\n
"
,
icon_info
.
xHotspot
);
ok
(
icon_info
.
yHotspot
==
3
,
"yHotspot is %u.
\n
"
,
icon_info
.
yHotspot
);
ok
(
icon_info
.
hbmColor
!=
NULL
,
"No hbmColor!
\n
"
);
ok
(
icon_info
.
hbmMask
!=
NULL
,
"No hbmMask!
\n
"
);
}
/* Clean up. */
SetLastError
(
0xdeadbeef
);
ret
=
DestroyCursor
(
handle
);
ok
(
ret
,
"DestroyCursor() failed.
\n
"
);
error
=
GetLastError
();
ok
(
error
==
0xdeadbeef
,
"Last error: %u
\n
"
,
error
);
/* Test creating an icon. */
SetLastError
(
0xdeadbeef
);
handle
=
CreateIconFromResource
((
PBYTE
)
icon_header
,
ICON_RES_SIZE
,
TRUE
,
0x00030000
);
ok
(
handle
!=
NULL
,
"Create icon failed.
\n
"
);
/* Test the icon information. */
SetLastError
(
0xdeadbeef
);
ret
=
GetIconInfo
(
handle
,
&
icon_info
);
ok
(
ret
,
"GetIconInfo() failed.
\n
"
);
error
=
GetLastError
();
ok
(
error
==
0xdeadbeef
,
"Last error: %u
\n
"
,
error
);
if
(
ret
)
{
ok
(
icon_info
.
fIcon
==
TRUE
,
"fIcon != TRUE.
\n
"
);
/* Icons always have hotspot in the middle */
ok
(
icon_info
.
xHotspot
==
ICON_WIDTH
/
2
,
"xHotspot is %u.
\n
"
,
icon_info
.
xHotspot
);
ok
(
icon_info
.
yHotspot
==
ICON_HEIGHT
/
2
,
"yHotspot is %u.
\n
"
,
icon_info
.
yHotspot
);
ok
(
icon_info
.
hbmColor
!=
NULL
,
"No hbmColor!
\n
"
);
ok
(
icon_info
.
hbmMask
!=
NULL
,
"No hbmMask!
\n
"
);
}
/* Clean up. */
SetLastError
(
0xdeadbeef
);
ret
=
DestroyCursor
(
handle
);
ok
(
ret
,
"DestroyCursor() failed.
\n
"
);
error
=
GetLastError
();
ok
(
error
==
0xdeadbeef
,
"Last error: %u
\n
"
,
error
);
HeapFree
(
GetProcessHeap
(),
0
,
hotspot
);
}
static
void
test_DestroyCursor
(
void
)
{
static
const
BYTE
bmp_bits
[
4096
];
...
...
@@ -955,6 +1048,7 @@ START_TEST(cursoricon)
test_initial_cursor
();
test_CreateIcon
();
test_LoadImage
();
test_CreateIconFromResource
();
test_DestroyCursor
();
do_parent
();
test_child_process
();
...
...
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