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
1936fd99
Commit
1936fd99
authored
Feb 21, 2007
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Feb 21, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add a CreateIcon test, make it pass under Wine.
parent
e35db340
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
2 deletions
+141
-2
cursoricon.c
dlls/user32/cursoricon.c
+1
-1
cursoricon.c
dlls/user32/tests/cursoricon.c
+140
-1
No files found.
dlls/user32/cursoricon.c
View file @
1936fd99
...
...
@@ -1841,7 +1841,7 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
else
{
info
->
nWidth
=
bmpAnd
.
bmWidth
;
info
->
nHeight
=
bmpAnd
.
bmHeight
*
2
;
info
->
nHeight
=
bmpAnd
.
bmHeight
/
2
;
info
->
nWidthBytes
=
get_bitmap_width_bytes
(
bmpAnd
.
bmWidth
,
1
);
info
->
bPlanes
=
1
;
info
->
bBitsPerPixel
=
1
;
...
...
dlls/user32/tests/cursoricon.c
View file @
1936fd99
/* Unit test suite for cursors and icons.
/*
* Unit test suite for cursors and icons.
*
* Copyright 2006 Michael Kaufmann
* Copyright 2007 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -235,6 +237,142 @@ static void test_CopyImage_Bitmap(int depth)
HeapFree
(
GetProcessHeap
(),
0
,
info
);
}
static
void
test_icon_info_dbg
(
HICON
hIcon
,
UINT
exp_cx
,
UINT
exp_cy
,
UINT
exp_bpp
,
int
line
)
{
ICONINFO
info
;
DWORD
ret
;
BITMAP
bmMask
,
bmColor
;
ret
=
GetIconInfo
(
hIcon
,
&
info
);
ok_
(
__FILE__
,
line
)(
ret
,
"GetIconInfo failed
\n
"
);
/* CreateIcon under XP causes info.fIcon to be 0 */
ok_
(
__FILE__
,
line
)(
info
.
xHotspot
==
exp_cx
/
2
,
"info.xHotspot = %u
\n
"
,
info
.
xHotspot
);
ok_
(
__FILE__
,
line
)(
info
.
yHotspot
==
exp_cy
/
2
,
"info.yHotspot = %u
\n
"
,
info
.
yHotspot
);
ok_
(
__FILE__
,
line
)(
info
.
hbmMask
!=
0
,
"info.hbmMask is NULL
\n
"
);
ret
=
GetObject
(
info
.
hbmMask
,
sizeof
(
bmMask
),
&
bmMask
);
ok_
(
__FILE__
,
line
)(
ret
==
sizeof
(
bmMask
),
"GetObject(info.hbmMask) failed, ret %u
\n
"
,
ret
);
if
(
exp_bpp
==
1
)
ok_
(
__FILE__
,
line
)(
info
.
hbmColor
==
0
,
"info.hbmColor should be NULL
\n
"
);
if
(
info
.
hbmColor
)
{
HDC
hdc
;
UINT
display_bpp
;
hdc
=
GetDC
(
0
);
display_bpp
=
GetDeviceCaps
(
hdc
,
BITSPIXEL
);
ReleaseDC
(
0
,
hdc
);
ret
=
GetObject
(
info
.
hbmColor
,
sizeof
(
bmColor
),
&
bmColor
);
ok_
(
__FILE__
,
line
)(
ret
==
sizeof
(
bmColor
),
"GetObject(info.hbmColor) failed, ret %u
\n
"
,
ret
);
ok_
(
__FILE__
,
line
)(
bmColor
.
bmBitsPixel
==
display_bpp
/* XP */
||
bmColor
.
bmBitsPixel
==
exp_bpp
/* Win98 */
,
"bmColor.bmBitsPixel = %d
\n
"
,
bmColor
.
bmBitsPixel
);
ok_
(
__FILE__
,
line
)(
bmColor
.
bmWidth
==
exp_cx
,
"bmColor.bmWidth = %d
\n
"
,
bmColor
.
bmWidth
);
ok_
(
__FILE__
,
line
)(
bmColor
.
bmHeight
==
exp_cy
,
"bmColor.bmHeight = %d
\n
"
,
bmColor
.
bmHeight
);
ok_
(
__FILE__
,
line
)(
bmMask
.
bmBitsPixel
==
1
,
"bmMask.bmBitsPixel = %d
\n
"
,
bmMask
.
bmBitsPixel
);
ok_
(
__FILE__
,
line
)(
bmMask
.
bmWidth
==
exp_cx
,
"bmMask.bmWidth = %d
\n
"
,
bmMask
.
bmWidth
);
ok_
(
__FILE__
,
line
)(
bmMask
.
bmHeight
==
exp_cy
,
"bmMask.bmHeight = %d
\n
"
,
bmMask
.
bmHeight
);
}
else
{
ok_
(
__FILE__
,
line
)(
bmMask
.
bmBitsPixel
==
1
,
"bmMask.bmBitsPixel = %d
\n
"
,
bmMask
.
bmBitsPixel
);
ok_
(
__FILE__
,
line
)(
bmMask
.
bmWidth
==
exp_cx
,
"bmMask.bmWidth = %d
\n
"
,
bmMask
.
bmWidth
);
ok_
(
__FILE__
,
line
)(
bmMask
.
bmHeight
==
exp_cy
*
2
,
"bmMask.bmHeight = %d
\n
"
,
bmMask
.
bmHeight
);
}
}
#define test_icon_info(a,b,c,d) test_icon_info_dbg((a),(b),(c),(d),__LINE__)
static
void
test_CreateIcon
(
void
)
{
static
const
BYTE
bmp_bits
[
1024
];
HICON
hIcon
;
HBITMAP
hbmMask
,
hbmColor
;
ICONINFO
info
;
HDC
hdc
;
UINT
display_bpp
;
hdc
=
GetDC
(
0
);
display_bpp
=
GetDeviceCaps
(
hdc
,
BITSPIXEL
);
ReleaseDC
(
0
,
hdc
);
/* these crash under XP
hIcon = CreateIcon(0, 16, 16, 1, 1, bmp_bits, NULL);
hIcon = CreateIcon(0, 16, 16, 1, 1, NULL, bmp_bits);
*/
hIcon
=
CreateIcon
(
0
,
16
,
16
,
1
,
1
,
bmp_bits
,
bmp_bits
);
ok
(
hIcon
!=
0
,
"CreateIcon failed
\n
"
);
test_icon_info
(
hIcon
,
16
,
16
,
1
);
DestroyIcon
(
hIcon
);
hIcon
=
CreateIcon
(
0
,
16
,
16
,
1
,
display_bpp
,
bmp_bits
,
bmp_bits
);
ok
(
hIcon
!=
0
,
"CreateIcon failed
\n
"
);
test_icon_info
(
hIcon
,
16
,
16
,
display_bpp
);
DestroyIcon
(
hIcon
);
hbmMask
=
CreateBitmap
(
16
,
16
,
1
,
1
,
bmp_bits
);
ok
(
hbmMask
!=
0
,
"CreateBitmap failed
\n
"
);
hbmColor
=
CreateBitmap
(
16
,
16
,
1
,
display_bpp
,
bmp_bits
);
ok
(
hbmColor
!=
0
,
"CreateBitmap failed
\n
"
);
info
.
fIcon
=
TRUE
;
info
.
xHotspot
=
8
;
info
.
yHotspot
=
8
;
info
.
hbmMask
=
0
;
info
.
hbmColor
=
0
;
SetLastError
(
0xdeadbeaf
);
hIcon
=
CreateIconIndirect
(
&
info
);
ok
(
!
hIcon
,
"CreateIconIndirect should fail
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeaf
,
"wrong error %u
\n
"
,
GetLastError
());
info
.
fIcon
=
TRUE
;
info
.
xHotspot
=
8
;
info
.
yHotspot
=
8
;
info
.
hbmMask
=
0
;
info
.
hbmColor
=
hbmColor
;
SetLastError
(
0xdeadbeaf
);
hIcon
=
CreateIconIndirect
(
&
info
);
ok
(
!
hIcon
,
"CreateIconIndirect should fail
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeaf
,
"wrong error %u
\n
"
,
GetLastError
());
info
.
fIcon
=
TRUE
;
info
.
xHotspot
=
8
;
info
.
yHotspot
=
8
;
info
.
hbmMask
=
hbmMask
;
info
.
hbmColor
=
hbmColor
;
hIcon
=
CreateIconIndirect
(
&
info
);
ok
(
hIcon
!=
0
,
"CreateIconIndirect failed
\n
"
);
test_icon_info
(
hIcon
,
16
,
16
,
display_bpp
);
DestroyIcon
(
hIcon
);
DeleteObject
(
hbmMask
);
DeleteObject
(
hbmColor
);
hbmMask
=
CreateBitmap
(
16
,
32
,
1
,
1
,
bmp_bits
);
ok
(
hbmMask
!=
0
,
"CreateBitmap failed
\n
"
);
info
.
fIcon
=
TRUE
;
info
.
xHotspot
=
8
;
info
.
yHotspot
=
8
;
info
.
hbmMask
=
hbmMask
;
info
.
hbmColor
=
0
;
SetLastError
(
0xdeadbeaf
);
hIcon
=
CreateIconIndirect
(
&
info
);
ok
(
hIcon
!=
0
,
"CreateIconIndirect failed
\n
"
);
test_icon_info
(
hIcon
,
16
,
16
,
1
);
DestroyIcon
(
hIcon
);
DeleteObject
(
hbmMask
);
DeleteObject
(
hbmColor
);
}
START_TEST
(
cursoricon
)
{
test_CopyImage_Bitmap
(
1
);
...
...
@@ -243,4 +381,5 @@ START_TEST(cursoricon)
test_CopyImage_Bitmap
(
16
);
test_CopyImage_Bitmap
(
24
);
test_CopyImage_Bitmap
(
32
);
test_CreateIcon
();
}
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