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
fd68a983
Commit
fd68a983
authored
Jan 09, 2019
by
Paul Gofman
Committed by
Alexandre Julliard
Jan 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add tests for stretch mode in LoadImage().
Signed-off-by:
Paul Gofman
<
gofmanp@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9cd885f4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
3 deletions
+46
-3
cursoricon.c
dlls/user32/tests/cursoricon.c
+46
-3
No files found.
dlls/user32/tests/cursoricon.c
View file @
fd68a983
...
...
@@ -1203,6 +1203,40 @@ static void create_ico_file(const char *filename, const test_icon_entries_t *tes
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
static
void
create_bitmap_file
(
const
char
*
filename
,
const
BITMAPINFO
*
bmi
,
const
unsigned
char
*
bits
)
{
unsigned
int
clr_used
,
bmi_size
,
bits_size
,
stride
;
const
BITMAPINFOHEADER
*
h
=
&
bmi
->
bmiHeader
;
BITMAPFILEHEADER
hdr
;
DWORD
bytes_written
;
HANDLE
file
;
BOOL
ret
;
clr_used
=
h
->
biBitCount
<=
8
?
1u
<<
h
->
biBitCount
:
0
;
stride
=
((
h
->
biBitCount
*
h
->
biWidth
+
7
)
/
8
+
3
)
&
~
3
;
bits_size
=
h
->
biHeight
*
stride
;
bmi_size
=
h
->
biSize
+
clr_used
*
sizeof
(
RGBQUAD
);
hdr
.
bfType
=
0x4d42
;
hdr
.
bfOffBits
=
(
DWORD
)
sizeof
(
BITMAPFILEHEADER
)
+
bmi_size
;
hdr
.
bfSize
=
hdr
.
bfOffBits
+
bits_size
;
hdr
.
bfReserved1
=
0
;
hdr
.
bfReserved2
=
0
;
file
=
CreateFileA
(
filename
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed, result %u.
\n
"
,
GetLastError
());
ret
=
WriteFile
(
file
,
&
hdr
,
sizeof
(
hdr
),
&
bytes_written
,
NULL
);
ok
(
ret
&&
bytes_written
==
sizeof
(
hdr
),
"Unexpected WriteFile() result, ret %#x, bytes_written %u.
\n
"
,
ret
,
bytes_written
);
ret
=
WriteFile
(
file
,
bmi
,
bmi_size
,
&
bytes_written
,
NULL
);
ok
(
ret
&&
bytes_written
==
bmi_size
,
"Unexpected WriteFile() result, ret %#x, bytes_written %u.
\n
"
,
ret
,
bytes_written
);
ret
=
WriteFile
(
file
,
bits
,
bits_size
,
&
bytes_written
,
NULL
);
ok
(
ret
&&
bytes_written
==
bits_size
,
"Unexpected WriteFile() result, ret %#x, bytes_written %u.
\n
"
,
ret
,
bytes_written
);
CloseHandle
(
file
);
}
static
void
test_LoadImage_working_directory_run
(
char
*
path
)
{
DWORD
bytes_written
;
...
...
@@ -2806,7 +2840,7 @@ static void compare_bitmap_bits_(unsigned int line, HDC hdc, HBITMAP bitmap, BIT
HeapFree
(
GetProcessHeap
(),
0
,
result_bits
);
}
static
void
test_
Copy
Image_StretchMode
(
void
)
static
void
test_Image_StretchMode
(
void
)
{
static
const
unsigned
char
test_bits_24
[]
=
{
...
...
@@ -2888,7 +2922,7 @@ static void test_CopyImage_StretchMode(void)
{
4
,
4
,
2
,
2
,
16
,
(
const
unsigned
char
*
)
test_bits_16
,
(
const
unsigned
char
*
)
expected_bits_16
,
sizeof
(
test_bits_16
),
sizeof
(
expected_bits_16
),
NULL
,
0
,
TRUE
},
};
static
const
char
filename
[]
=
"test.bmp"
;
BITMAPINFO
*
bmi
,
*
bmi_output
;
HBITMAP
bitmap
,
bitmap_copy
;
unsigned
int
test_index
;
...
...
@@ -2935,6 +2969,15 @@ static void test_CopyImage_StretchMode(void)
tests
[
test_index
].
expected_bits
,
test_index
,
tests
[
test_index
].
todo
);
DeleteObject
(
bitmap
);
DeleteObject
(
bitmap_copy
);
create_bitmap_file
(
filename
,
bmi
,
tests
[
test_index
].
test_bits
);
bitmap
=
LoadImageA
(
NULL
,
filename
,
IMAGE_BITMAP
,
tests
[
test_index
].
output_width
,
tests
[
test_index
].
output_height
,
LR_CREATEDIBSECTION
|
LR_LOADFROMFILE
);
ok
(
!!
bitmap
,
"LoadImageA() failed, result %u.
\n
"
,
GetLastError
());
DeleteFileA
(
filename
);
compare_bitmap_bits
(
hdc
,
bitmap
,
bmi_output
,
tests
[
test_index
].
result_bits_size
,
tests
[
test_index
].
expected_bits
,
test_index
,
tests
[
test_index
].
todo
);
DeleteObject
(
bitmap
);
}
ReleaseDC
(
0
,
hdc
);
HeapFree
(
GetProcessHeap
(),
0
,
bmi_output
);
...
...
@@ -2968,7 +3011,7 @@ START_TEST(cursoricon)
test_CopyImage_Bitmap
(
16
);
test_CopyImage_Bitmap
(
24
);
test_CopyImage_Bitmap
(
32
);
test_
Copy
Image_StretchMode
();
test_Image_StretchMode
();
test_initial_cursor
();
test_CreateIcon
();
test_LoadImage
();
...
...
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