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
5c1b27a0
Commit
5c1b27a0
authored
Mar 20, 2006
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Mar 20, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi: Add a simple test for bitmap bits/metrics
Add a simple test for bitmap bits/metrics, fix GetBitmapBits for an empty (not selected into a DC) bitmap.
parent
5052dccc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
2 deletions
+84
-2
bitmap.c
dlls/gdi/bitmap.c
+3
-2
gdiobj.c
dlls/gdi/tests/gdiobj.c
+81
-0
No files found.
dlls/gdi/bitmap.c
View file @
5c1b27a0
...
...
@@ -366,8 +366,9 @@ LONG WINAPI GetBitmapBits(
}
else
{
if
(
!
bmp
->
bitmap
.
bmBits
)
{
WARN
(
"Bitmap is empty
\n
"
);
ret
=
0
;
TRACE
(
"Bitmap is empty
\n
"
);
memset
(
bits
,
0
,
count
);
ret
=
count
;
}
else
{
memcpy
(
bits
,
bmp
->
bitmap
.
bmBits
,
count
);
ret
=
count
;
...
...
dlls/gdi/tests/gdiobj.c
View file @
5c1b27a0
...
...
@@ -982,10 +982,91 @@ else
}
}
static
void
test_bitmap
(
void
)
{
char
buf
[
256
],
buf_cmp
[
256
];
HBITMAP
hbmp
,
hbmp_old
;
HDC
hdc
;
BITMAP
bm
;
INT
ret
;
hdc
=
CreateCompatibleDC
(
0
);
assert
(
hdc
!=
0
);
hbmp
=
CreateBitmap
(
15
,
15
,
1
,
1
,
NULL
);
assert
(
hbmp
!=
NULL
);
ret
=
GetObject
(
hbmp
,
sizeof
(
bm
),
&
bm
);
ok
(
ret
==
sizeof
(
bm
),
"%d != %d
\n
"
,
ret
,
sizeof
(
bm
));
ok
(
bm
.
bmType
==
0
,
"wrong bm.bmType %d
\n
"
,
bm
.
bmType
);
ok
(
bm
.
bmWidth
==
15
,
"wrong bm.bmWidth %d
\n
"
,
bm
.
bmWidth
);
ok
(
bm
.
bmHeight
==
15
,
"wrong bm.bmHeight %d
\n
"
,
bm
.
bmHeight
);
ok
(
bm
.
bmWidthBytes
==
2
,
"wrong bm.bmWidthBytes %d
\n
"
,
bm
.
bmWidthBytes
);
ok
(
bm
.
bmPlanes
==
1
,
"wrong bm.bmPlanes %d
\n
"
,
bm
.
bmPlanes
);
ok
(
bm
.
bmBitsPixel
==
1
,
"wrong bm.bmBitsPixel %d
\n
"
,
bm
.
bmBitsPixel
);
ok
(
bm
.
bmBits
==
NULL
,
"wrong bm.bmBits %p
\n
"
,
bm
.
bmBits
);
assert
(
sizeof
(
buf
)
>=
bm
.
bmWidthBytes
*
bm
.
bmHeight
);
assert
(
sizeof
(
buf
)
==
sizeof
(
buf_cmp
));
memset
(
buf_cmp
,
0xAA
,
sizeof
(
buf_cmp
));
memset
(
buf_cmp
,
0
,
bm
.
bmWidthBytes
*
bm
.
bmHeight
);
memset
(
buf
,
0xAA
,
sizeof
(
buf
));
ret
=
GetBitmapBits
(
hbmp
,
sizeof
(
buf
),
buf
);
ok
(
ret
==
bm
.
bmWidthBytes
*
bm
.
bmHeight
,
"%d != %d
\n
"
,
ret
,
bm
.
bmWidthBytes
*
bm
.
bmHeight
);
ok
(
!
memcmp
(
buf
,
buf_cmp
,
sizeof
(
buf
)),
"buffers do not match
\n
"
);
hbmp_old
=
SelectObject
(
hdc
,
hbmp
);
ret
=
GetObject
(
hbmp
,
sizeof
(
bm
),
&
bm
);
ok
(
ret
==
sizeof
(
bm
),
"%d != %d
\n
"
,
ret
,
sizeof
(
bm
));
ok
(
bm
.
bmType
==
0
,
"wrong bm.bmType %d
\n
"
,
bm
.
bmType
);
ok
(
bm
.
bmWidth
==
15
,
"wrong bm.bmWidth %d
\n
"
,
bm
.
bmWidth
);
ok
(
bm
.
bmHeight
==
15
,
"wrong bm.bmHeight %d
\n
"
,
bm
.
bmHeight
);
ok
(
bm
.
bmWidthBytes
==
2
,
"wrong bm.bmWidthBytes %d
\n
"
,
bm
.
bmWidthBytes
);
ok
(
bm
.
bmPlanes
==
1
,
"wrong bm.bmPlanes %d
\n
"
,
bm
.
bmPlanes
);
ok
(
bm
.
bmBitsPixel
==
1
,
"wrong bm.bmBitsPixel %d
\n
"
,
bm
.
bmBitsPixel
);
ok
(
bm
.
bmBits
==
NULL
,
"wrong bm.bmBits %p
\n
"
,
bm
.
bmBits
);
memset
(
buf
,
0xAA
,
sizeof
(
buf
));
ret
=
GetBitmapBits
(
hbmp
,
sizeof
(
buf
),
buf
);
ok
(
ret
==
bm
.
bmWidthBytes
*
bm
.
bmHeight
,
"%d != %d
\n
"
,
ret
,
bm
.
bmWidthBytes
*
bm
.
bmHeight
);
todo_wine
{
ok
(
!
memcmp
(
buf
,
buf_cmp
,
sizeof
(
buf
)),
"buffers do not match
\n
"
);
}
hbmp_old
=
SelectObject
(
hdc
,
hbmp_old
);
ok
(
hbmp_old
==
hbmp
,
"wrong old bitmap %p
\n
"
,
hbmp_old
);
/* test various buffer sizes for GetObject */
ret
=
GetObject
(
hbmp
,
sizeof
(
bm
)
*
2
,
&
bm
);
ok
(
ret
==
sizeof
(
bm
),
"%d != %d
\n
"
,
ret
,
sizeof
(
bm
));
ret
=
GetObject
(
hbmp
,
sizeof
(
bm
)
/
2
,
&
bm
);
todo_wine
{
ok
(
ret
==
0
,
"%d != 0
\n
"
,
ret
);
}
ret
=
GetObject
(
hbmp
,
0
,
&
bm
);
ok
(
ret
==
0
,
"%d != 0
\n
"
,
ret
);
ret
=
GetObject
(
hbmp
,
1
,
&
bm
);
todo_wine
{
ok
(
ret
==
0
,
"%d != 0
\n
"
,
ret
);
}
DeleteObject
(
hbmp
);
DeleteDC
(
hdc
);
}
START_TEST
(
gdiobj
)
{
test_logfont
();
test_logpen
();
test_bitmap
();
test_bitmap_font
();
test_bitmap_font_metrics
();
test_gdi_objects
();
...
...
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