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
4ec87b3e
Commit
4ec87b3e
authored
Nov 01, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add some brush tests.
parent
ed4143b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
147 additions
and
4 deletions
+147
-4
brush.c
dlls/gdi32/brush.c
+11
-3
brush.c
dlls/gdi32/tests/brush.c
+136
-1
No files found.
dlls/gdi32/brush.c
View file @
4ec87b3e
...
...
@@ -108,11 +108,17 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
switch
(
ptr
->
logbrush
.
lbStyle
)
{
case
BS_SOLID
:
case
BS_HOLLOW
:
case
BS_HATCHED
:
break
;
case
BS_PATTERN8X8
:
ptr
->
logbrush
.
lbStyle
=
BS_PATTERN
;
/* fall through */
case
BS_PATTERN
:
ptr
->
logbrush
.
lbHatch
=
(
ULONG_PTR
)
BITMAP_CopyBitmap
(
(
HBITMAP
)
ptr
->
logbrush
.
lbHatch
);
ptr
->
logbrush
.
lbColor
=
0
;
if
(
!
ptr
->
logbrush
.
lbHatch
)
goto
error
;
break
;
...
...
@@ -123,7 +129,6 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
if
(
!
ptr
->
logbrush
.
lbHatch
)
goto
error
;
break
;
case
BS_DIBPATTERN8X8
:
case
BS_DIBPATTERN
:
{
BITMAPINFO
*
bmi
;
...
...
@@ -137,9 +142,12 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
break
;
}
case
BS_DIBPATTERN8X8
:
case
BS_MONOPATTERN
:
case
BS_INDEXED
:
default:
if
(
ptr
->
logbrush
.
lbStyle
>
BS_MONOPATTERN
)
goto
error
;
break
;
WARN
(
"invalid brush style %u
\n
"
,
ptr
->
logbrush
.
lbStyle
)
;
goto
error
;
}
if
((
hbrush
=
alloc_gdi_handle
(
&
ptr
->
header
,
OBJ_BRUSH
,
&
brush_funcs
)))
...
...
dlls/gdi32/tests/brush.c
View file @
4ec87b3e
...
...
@@ -78,8 +78,143 @@ static void test_solidbrush(void)
"GetObject succeeded on a deleted %s brush
\n
"
,
stock
[
i
].
name
);
}
}
static
void
test_pattern_brush
(
void
)
{
char
buffer
[
sizeof
(
BITMAPINFOHEADER
)
+
2
*
sizeof
(
RGBQUAD
)
+
32
*
32
/
8
];
BITMAPINFO
*
info
=
(
BITMAPINFO
*
)
buffer
;
HBRUSH
brush
;
HBITMAP
bitmap
;
LOGBRUSH
br
;
INT
ret
;
void
*
bits
;
DIBSECTION
dib
;
HGLOBAL
mem
;
bitmap
=
CreateBitmap
(
20
,
20
,
1
,
1
,
NULL
);
ok
(
bitmap
!=
NULL
,
"CreateBitmap failed
\n
"
);
brush
=
CreatePatternBrush
(
bitmap
);
ok
(
brush
!=
NULL
,
"CreatePatternBrush failed
\n
"
);
memset
(
&
br
,
0x55
,
sizeof
(
br
)
);
ret
=
GetObjectW
(
brush
,
sizeof
(
br
),
&
br
);
ok
(
ret
==
sizeof
(
br
),
"wrong size %u
\n
"
,
ret
);
ok
(
br
.
lbStyle
==
BS_PATTERN
,
"wrong style %u
\n
"
,
br
.
lbStyle
);
ok
(
br
.
lbColor
==
0
,
"wrong color %u
\n
"
,
br
.
lbColor
);
todo_wine
ok
(
(
HBITMAP
)
br
.
lbHatch
==
bitmap
,
"wrong handle %p/%p
\n
"
,
(
HBITMAP
)
br
.
lbHatch
,
bitmap
);
DeleteObject
(
brush
);
br
.
lbStyle
=
BS_PATTERN8X8
;
br
.
lbColor
=
0x12345
;
br
.
lbHatch
=
(
ULONG_PTR
)
bitmap
;
brush
=
CreateBrushIndirect
(
&
br
);
ok
(
brush
!=
NULL
,
"CreatePatternBrush failed
\n
"
);
memset
(
&
br
,
0x55
,
sizeof
(
br
)
);
ret
=
GetObjectW
(
brush
,
sizeof
(
br
),
&
br
);
ok
(
ret
==
sizeof
(
br
),
"wrong size %u
\n
"
,
ret
);
ok
(
br
.
lbStyle
==
BS_PATTERN
,
"wrong style %u
\n
"
,
br
.
lbStyle
);
ok
(
br
.
lbColor
==
0
,
"wrong color %u
\n
"
,
br
.
lbColor
);
todo_wine
ok
(
(
HBITMAP
)
br
.
lbHatch
==
bitmap
,
"wrong handle %p/%p
\n
"
,
(
HBITMAP
)
br
.
lbHatch
,
bitmap
);
ret
=
GetObjectW
(
bitmap
,
sizeof
(
dib
),
&
dib
);
ok
(
ret
==
sizeof
(
dib
.
dsBm
),
"wrong size %u
\n
"
,
ret
);
DeleteObject
(
bitmap
);
ret
=
GetObjectW
(
bitmap
,
sizeof
(
dib
),
&
dib
);
ok
(
ret
==
0
,
"wrong size %u
\n
"
,
ret
);
DeleteObject
(
brush
);
memset
(
info
,
0
,
sizeof
(
buffer
)
);
info
->
bmiHeader
.
biSize
=
sizeof
(
info
->
bmiHeader
);
info
->
bmiHeader
.
biHeight
=
32
;
info
->
bmiHeader
.
biWidth
=
32
;
info
->
bmiHeader
.
biBitCount
=
1
;
info
->
bmiHeader
.
biPlanes
=
1
;
info
->
bmiHeader
.
biCompression
=
BI_RGB
;
bitmap
=
CreateDIBSection
(
0
,
info
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
ok
(
bitmap
!=
NULL
,
"CreateDIBSection failed
\n
"
);
/* MSDN says a DIB section is not allowed, but it works fine */
brush
=
CreatePatternBrush
(
bitmap
);
ok
(
brush
!=
NULL
,
"CreatePatternBrush failed
\n
"
);
memset
(
&
br
,
0x55
,
sizeof
(
br
)
);
ret
=
GetObjectW
(
brush
,
sizeof
(
br
),
&
br
);
ok
(
ret
==
sizeof
(
br
),
"wrong size %u
\n
"
,
ret
);
ok
(
br
.
lbStyle
==
BS_PATTERN
,
"wrong style %u
\n
"
,
br
.
lbStyle
);
ok
(
br
.
lbColor
==
0
,
"wrong color %u
\n
"
,
br
.
lbColor
);
todo_wine
ok
(
(
HBITMAP
)
br
.
lbHatch
==
bitmap
,
"wrong handle %p/%p
\n
"
,
(
HBITMAP
)
br
.
lbHatch
,
bitmap
);
ret
=
GetObjectW
(
bitmap
,
sizeof
(
dib
),
&
dib
);
ok
(
ret
==
sizeof
(
dib
),
"wrong size %u
\n
"
,
ret
);
DeleteObject
(
brush
);
DeleteObject
(
bitmap
);
brush
=
CreateDIBPatternBrushPt
(
info
,
DIB_RGB_COLORS
);
ok
(
brush
!=
NULL
,
"CreatePatternBrush failed
\n
"
);
memset
(
&
br
,
0x55
,
sizeof
(
br
)
);
ret
=
GetObjectW
(
brush
,
sizeof
(
br
),
&
br
);
ok
(
ret
==
sizeof
(
br
),
"wrong size %u
\n
"
,
ret
);
ok
(
br
.
lbStyle
==
BS_DIBPATTERN
,
"wrong style %u
\n
"
,
br
.
lbStyle
);
ok
(
br
.
lbColor
==
0
,
"wrong color %u
\n
"
,
br
.
lbColor
);
todo_wine
ok
(
(
BITMAPINFO
*
)
br
.
lbHatch
==
info
||
broken
(
!
br
.
lbHatch
),
/* nt4 */
"wrong handle %p/%p
\n
"
,
(
BITMAPINFO
*
)
br
.
lbHatch
,
info
);
DeleteObject
(
brush
);
br
.
lbStyle
=
BS_DIBPATTERNPT
;
br
.
lbColor
=
DIB_PAL_COLORS
;
br
.
lbHatch
=
(
ULONG_PTR
)
info
;
brush
=
CreateBrushIndirect
(
&
br
);
ok
(
brush
!=
NULL
,
"CreatePatternBrush failed
\n
"
);
memset
(
&
br
,
0x55
,
sizeof
(
br
)
);
ret
=
GetObjectW
(
brush
,
sizeof
(
br
),
&
br
);
ok
(
ret
==
sizeof
(
br
),
"wrong size %u
\n
"
,
ret
);
ok
(
br
.
lbStyle
==
BS_DIBPATTERN
,
"wrong style %u
\n
"
,
br
.
lbStyle
);
todo_wine
ok
(
br
.
lbColor
==
0
,
"wrong color %u
\n
"
,
br
.
lbColor
);
todo_wine
ok
(
(
BITMAPINFO
*
)
br
.
lbHatch
==
info
||
broken
(
!
br
.
lbHatch
),
/* nt4 */
"wrong handle %p/%p
\n
"
,
(
BITMAPINFO
*
)
br
.
lbHatch
,
info
);
mem
=
GlobalAlloc
(
GMEM_MOVEABLE
,
sizeof
(
buffer
)
);
memcpy
(
GlobalLock
(
mem
),
buffer
,
sizeof
(
buffer
)
);
br
.
lbStyle
=
BS_DIBPATTERN
;
br
.
lbColor
=
DIB_PAL_COLORS
;
br
.
lbHatch
=
(
ULONG_PTR
)
mem
;
brush
=
CreateBrushIndirect
(
&
br
);
ok
(
brush
!=
NULL
,
"CreatePatternBrush failed
\n
"
);
memset
(
&
br
,
0x55
,
sizeof
(
br
)
);
ret
=
GetObjectW
(
brush
,
sizeof
(
br
),
&
br
);
ok
(
ret
==
sizeof
(
br
),
"wrong size %u
\n
"
,
ret
);
ok
(
br
.
lbStyle
==
BS_DIBPATTERN
,
"wrong style %u
\n
"
,
br
.
lbStyle
);
todo_wine
ok
(
br
.
lbColor
==
0
,
"wrong color %u
\n
"
,
br
.
lbColor
);
ok
(
(
HGLOBAL
)
br
.
lbHatch
!=
mem
,
"wrong handle %p/%p
\n
"
,
(
HGLOBAL
)
br
.
lbHatch
,
mem
);
bits
=
GlobalLock
(
mem
);
todo_wine
ok
(
(
HGLOBAL
)
br
.
lbHatch
==
bits
||
broken
(
!
br
.
lbHatch
),
/* nt4 */
"wrong handle %p/%p
\n
"
,
(
HGLOBAL
)
br
.
lbHatch
,
bits
);
ret
=
GlobalFlags
(
mem
);
ok
(
ret
==
2
,
"wrong flags %x
\n
"
,
ret
);
DeleteObject
(
brush
);
ret
=
GlobalFlags
(
mem
);
ok
(
ret
==
2
,
"wrong flags %x
\n
"
,
ret
);
br
.
lbStyle
=
BS_DIBPATTERN8X8
;
br
.
lbColor
=
DIB_RGB_COLORS
;
br
.
lbHatch
=
(
ULONG_PTR
)
mem
;
brush
=
CreateBrushIndirect
(
&
br
);
ok
(
!
brush
,
"CreatePatternBrush succeeded
\n
"
);
br
.
lbStyle
=
BS_MONOPATTERN
;
br
.
lbColor
=
DIB_RGB_COLORS
;
br
.
lbHatch
=
(
ULONG_PTR
)
mem
;
brush
=
CreateBrushIndirect
(
&
br
);
ok
(
!
brush
,
"CreatePatternBrush succeeded
\n
"
);
br
.
lbStyle
=
BS_INDEXED
;
br
.
lbColor
=
DIB_RGB_COLORS
;
br
.
lbHatch
=
(
ULONG_PTR
)
mem
;
brush
=
CreateBrushIndirect
(
&
br
);
ok
(
!
brush
,
"CreatePatternBrush succeeded
\n
"
);
GlobalFree
(
mem
);
}
START_TEST
(
brush
)
{
test_solidbrush
();
test_pattern_brush
();
}
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