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
8afcff3c
Commit
8afcff3c
authored
Nov 02, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32/tests: Add some tests for palette-relative pattern brushes.
parent
2cf3975d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
brush.c
dlls/gdi32/tests/brush.c
+77
-0
No files found.
dlls/gdi32/tests/brush.c
View file @
8afcff3c
...
...
@@ -213,8 +213,85 @@ static void test_pattern_brush(void)
GlobalFree
(
mem
);
}
static
void
test_palette_brush
(
void
)
{
char
buffer
[
sizeof
(
BITMAPINFOHEADER
)
+
256
*
sizeof
(
RGBQUAD
)
+
16
*
16
];
BITMAPINFO
*
info
=
(
BITMAPINFO
*
)
buffer
;
WORD
*
indices
=
(
WORD
*
)
info
->
bmiColors
;
char
pal_buffer
[
sizeof
(
LOGPALETTE
)
+
256
*
sizeof
(
PALETTEENTRY
)];
LOGPALETTE
*
pal
=
(
LOGPALETTE
*
)
pal_buffer
;
HDC
hdc
=
CreateCompatibleDC
(
0
);
DWORD
*
dib_bits
;
HBITMAP
dib
;
HBRUSH
brush
;
int
i
;
HPALETTE
palette
,
palette2
;
memset
(
info
,
0
,
sizeof
(
*
info
)
);
info
->
bmiHeader
.
biSize
=
sizeof
(
info
->
bmiHeader
);
info
->
bmiHeader
.
biWidth
=
16
;
info
->
bmiHeader
.
biHeight
=
16
;
info
->
bmiHeader
.
biPlanes
=
1
;
info
->
bmiHeader
.
biBitCount
=
32
;
info
->
bmiHeader
.
biCompression
=
BI_RGB
;
dib
=
CreateDIBSection
(
NULL
,
info
,
DIB_RGB_COLORS
,
(
void
**
)
&
dib_bits
,
NULL
,
0
);
ok
(
dib
!=
NULL
,
"CreateDIBSection failed
\n
"
);
info
->
bmiHeader
.
biBitCount
=
8
;
for
(
i
=
0
;
i
<
256
;
i
++
)
indices
[
i
]
=
255
-
i
;
for
(
i
=
0
;
i
<
256
;
i
++
)
((
BYTE
*
)(
indices
+
256
))[
i
]
=
i
;
brush
=
CreateDIBPatternBrushPt
(
info
,
DIB_PAL_COLORS
);
ok
(
brush
!=
NULL
,
"CreateDIBPatternBrushPt failed
\n
"
);
pal
->
palVersion
=
0x300
;
pal
->
palNumEntries
=
256
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
pal
->
palPalEntry
[
i
].
peRed
=
i
*
2
;
pal
->
palPalEntry
[
i
].
peGreen
=
i
*
2
;
pal
->
palPalEntry
[
i
].
peBlue
=
i
*
2
;
pal
->
palPalEntry
[
i
].
peFlags
=
0
;
}
palette
=
CreatePalette
(
pal
);
ok
(
SelectObject
(
hdc
,
dib
)
!=
NULL
,
"SelectObject failed
\n
"
);
ok
(
SelectPalette
(
hdc
,
palette
,
0
)
!=
NULL
,
"SelectPalette failed
\n
"
);
ok
(
SelectObject
(
hdc
,
brush
)
!=
NULL
,
"SelectObject failed
\n
"
);
memset
(
dib_bits
,
0xaa
,
16
*
16
*
4
);
PatBlt
(
hdc
,
0
,
0
,
16
,
16
,
PATCOPY
);
for
(
i
=
0
;
i
<
256
;
i
++
)
{
DWORD
expect
=
(
pal
->
palPalEntry
[
255
-
i
].
peRed
<<
16
|
pal
->
palPalEntry
[
255
-
i
].
peGreen
<<
8
|
pal
->
palPalEntry
[
255
-
i
].
peBlue
);
ok
(
dib_bits
[
i
]
==
expect
,
"wrong bits %x/%x at %u,%u
\n
"
,
dib_bits
[
i
],
expect
,
i
%
16
,
i
/
16
);
}
for
(
i
=
0
;
i
<
256
;
i
++
)
pal
->
palPalEntry
[
i
].
peRed
=
i
*
3
;
palette2
=
CreatePalette
(
pal
);
ok
(
SelectPalette
(
hdc
,
palette2
,
0
)
!=
NULL
,
"SelectPalette failed
\n
"
);
memset
(
dib_bits
,
0xaa
,
16
*
16
*
4
);
PatBlt
(
hdc
,
0
,
0
,
16
,
16
,
PATCOPY
);
for
(
i
=
0
;
i
<
256
;
i
++
)
{
DWORD
expect
=
(
pal
->
palPalEntry
[
255
-
i
].
peRed
<<
16
|
pal
->
palPalEntry
[
255
-
i
].
peGreen
<<
8
|
pal
->
palPalEntry
[
255
-
i
].
peBlue
);
if
(
expect
)
todo_wine
ok
(
dib_bits
[
i
]
==
expect
,
"wrong bits %x/%x at %u,%u
\n
"
,
dib_bits
[
i
],
expect
,
i
%
16
,
i
/
16
);
else
ok
(
dib_bits
[
i
]
==
expect
,
"wrong bits %x/%x at %u,%u
\n
"
,
dib_bits
[
i
],
expect
,
i
%
16
,
i
/
16
);
}
DeleteDC
(
hdc
);
DeleteObject
(
dib
);
DeleteObject
(
brush
);
DeleteObject
(
palette
);
DeleteObject
(
palette2
);
}
START_TEST
(
brush
)
{
test_solidbrush
();
test_pattern_brush
();
test_palette_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