Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
89838342
Commit
89838342
authored
12 years ago
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
windowscodecs: Add a test for CreateBitmapFromHICON.
parent
84012247
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/windowscodecs/tests/Makefile.in
+1
-1
1 addition, 1 deletion
dlls/windowscodecs/tests/Makefile.in
dlls/windowscodecs/tests/bitmap.c
+92
-0
92 additions, 0 deletions
dlls/windowscodecs/tests/bitmap.c
with
93 additions
and
1 deletion
dlls/windowscodecs/tests/Makefile.in
+
1
−
1
View file @
89838342
TESTDLL
=
windowscodecs.dll
IMPORTS
=
ole32 windowscodecs
IMPORTS
=
gdi32 user32
ole32 windowscodecs
C_SRCS
=
\
bitmap.c
\
...
...
This diff is collapsed.
Click to expand it.
dlls/windowscodecs/tests/bitmap.c
+
92
−
0
View file @
89838342
...
...
@@ -18,6 +18,7 @@
*/
#include
<stdarg.h>
#include
<stdio.h>
#include
<math.h>
#define COBJMACROS
...
...
@@ -29,6 +30,18 @@
static
IWICImagingFactory
*
factory
;
static
const
char
*
debugstr_guid
(
const
GUID
*
guid
)
{
static
char
buf
[
50
];
if
(
!
guid
)
return
"(null)"
;
sprintf
(
buf
,
"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"
,
guid
->
Data1
,
guid
->
Data2
,
guid
->
Data3
,
guid
->
Data4
[
0
],
guid
->
Data4
[
1
],
guid
->
Data4
[
2
],
guid
->
Data4
[
3
],
guid
->
Data4
[
4
],
guid
->
Data4
[
5
],
guid
->
Data4
[
6
],
guid
->
Data4
[
7
]);
return
buf
;
}
static
void
test_createbitmap
(
void
)
{
HRESULT
hr
;
...
...
@@ -494,6 +507,84 @@ static void test_CreateBitmapFromMemory(void)
IWICBitmap_Release
(
bitmap
);
}
static
void
test_CreateBitmapFromHICON
(
void
)
{
static
const
char
bits
[
4096
];
HICON
icon
;
ICONINFO
info
;
HRESULT
hr
;
IWICBitmap
*
bitmap
;
UINT
width
,
height
;
WICPixelFormatGUID
format
;
/* 1 bpp mask */
info
.
fIcon
=
1
;
info
.
xHotspot
=
0
;
info
.
yHotspot
=
0
;
info
.
hbmColor
=
0
;
info
.
hbmMask
=
CreateBitmap
(
16
,
32
,
1
,
1
,
bits
);
ok
(
info
.
hbmMask
!=
0
,
"CreateBitmap failed
\n
"
);
icon
=
CreateIconIndirect
(
&
info
);
ok
(
icon
!=
0
,
"CreateIconIndirect failed
\n
"
);
DeleteObject
(
info
.
hbmMask
);
hr
=
IWICImagingFactory_CreateBitmapFromHICON
(
factory
,
0
,
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateBitmapFromHICON
(
factory
,
0
,
&
bitmap
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_CURSOR_HANDLE
),
"expected ERROR_INVALID_CURSOR_HANDLE, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateBitmapFromHICON
(
factory
,
icon
,
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateBitmapFromHICON
(
factory
,
icon
,
&
bitmap
);
todo_wine
ok
(
hr
==
S_OK
,
"CreateBitmapFromHICON error %#x
\n
"
,
hr
);
DestroyIcon
(
icon
);
if
(
hr
!=
S_OK
)
return
;
IWICBitmap_GetPixelFormat
(
bitmap
,
&
format
);
ok
(
IsEqualGUID
(
&
format
,
&
GUID_WICPixelFormat32bppBGRA
),
"unexpected pixel format %s
\n
"
,
debugstr_guid
(
&
format
));
IWICBitmap_GetSize
(
bitmap
,
&
width
,
&
height
);
ok
(
hr
==
S_OK
,
"IWICBitmap_GetSize error %#x
\n
"
,
hr
);
ok
(
width
==
16
,
"expected 16, got %u
\n
"
,
width
);
ok
(
height
==
16
,
"expected 16, got %u
\n
"
,
height
);
IWICBitmap_Release
(
bitmap
);
/* 24 bpp color, 1 bpp mask */
info
.
fIcon
=
1
;
info
.
xHotspot
=
0
;
info
.
yHotspot
=
0
;
info
.
hbmColor
=
CreateBitmap
(
16
,
16
,
1
,
24
,
bits
);
ok
(
info
.
hbmColor
!=
0
,
"CreateBitmap failed
\n
"
);
info
.
hbmMask
=
CreateBitmap
(
16
,
16
,
1
,
1
,
bits
);
ok
(
info
.
hbmMask
!=
0
,
"CreateBitmap failed
\n
"
);
icon
=
CreateIconIndirect
(
&
info
);
ok
(
icon
!=
0
,
"CreateIconIndirect failed
\n
"
);
DeleteObject
(
info
.
hbmColor
);
DeleteObject
(
info
.
hbmMask
);
hr
=
IWICImagingFactory_CreateBitmapFromHICON
(
factory
,
icon
,
&
bitmap
);
ok
(
hr
==
S_OK
,
"CreateBitmapFromHICON error %#x
\n
"
,
hr
);
DestroyIcon
(
icon
);
IWICBitmap_GetPixelFormat
(
bitmap
,
&
format
);
ok
(
IsEqualGUID
(
&
format
,
&
GUID_WICPixelFormat32bppBGRA
),
"unexpected pixel format %s
\n
"
,
debugstr_guid
(
&
format
));
IWICBitmap_GetSize
(
bitmap
,
&
width
,
&
height
);
ok
(
hr
==
S_OK
,
"IWICBitmap_GetSize error %#x
\n
"
,
hr
);
ok
(
width
==
16
,
"expected 16, got %u
\n
"
,
width
);
ok
(
height
==
16
,
"expected 16, got %u
\n
"
,
height
);
IWICBitmap_Release
(
bitmap
);
}
START_TEST
(
bitmap
)
{
...
...
@@ -508,6 +599,7 @@ START_TEST(bitmap)
test_createbitmap
();
test_createbitmapfromsource
();
test_CreateBitmapFromMemory
();
test_CreateBitmapFromHICON
();
IWICImagingFactory_Release
(
factory
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment