Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
82f82f69
Commit
82f82f69
authored
Sep 15, 2016
by
Vincent Povirk
Committed by
Alexandre Julliard
Sep 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs/tests: Add a helper function for comparing bits.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7431380e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
32 deletions
+26
-32
converter.c
dlls/windowscodecs/tests/converter.c
+26
-32
No files found.
dlls/windowscodecs/tests/converter.c
View file @
82f82f69
...
...
@@ -196,6 +196,29 @@ static void DeleteTestBitmap(BitmapTestSrc *This)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
static
BOOL
compare_bits
(
const
struct
bitmap_data
*
expect
,
UINT
buffersize
,
const
BYTE
*
converted_bits
)
{
BOOL
equal
;
if
(
IsEqualGUID
(
expect
->
format
,
&
GUID_WICPixelFormat32bppBGR
))
{
/* ignore the padding byte when comparing data */
UINT
i
;
const
DWORD
*
a
=
(
const
DWORD
*
)
expect
->
bits
,
*
b
=
(
const
DWORD
*
)
converted_bits
;
equal
=
TRUE
;
for
(
i
=
0
;
i
<
(
buffersize
/
4
);
i
++
)
if
((
a
[
i
]
&
0xffffff
)
!=
(
b
[
i
]
&
0xffffff
))
{
equal
=
FALSE
;
break
;
}
}
else
equal
=
(
memcmp
(
expect
->
bits
,
converted_bits
,
buffersize
)
==
0
);
return
equal
;
}
static
void
compare_bitmap_data
(
const
struct
bitmap_data
*
expect
,
IWICBitmapSource
*
source
,
const
char
*
name
)
{
BYTE
*
converted_bits
;
...
...
@@ -231,42 +254,13 @@ static void compare_bitmap_data(const struct bitmap_data *expect, IWICBitmapSour
converted_bits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buffersize
);
hr
=
IWICBitmapSource_CopyPixels
(
source
,
&
prc
,
stride
,
buffersize
,
converted_bits
);
ok
(
SUCCEEDED
(
hr
),
"CopyPixels(%s) failed, hr=%x
\n
"
,
name
,
hr
);
if
(
IsEqualGUID
(
expect
->
format
,
&
GUID_WICPixelFormat32bppBGR
))
{
/* ignore the padding byte when comparing data */
UINT
i
;
BOOL
equal
=
TRUE
;
const
DWORD
*
a
=
(
const
DWORD
*
)
expect
->
bits
,
*
b
=
(
const
DWORD
*
)
converted_bits
;
for
(
i
=
0
;
i
<
(
buffersize
/
4
);
i
++
)
if
((
a
[
i
]
&
0xffffff
)
!=
(
b
[
i
]
&
0xffffff
))
{
equal
=
FALSE
;
break
;
}
ok
(
equal
,
"unexpected pixel data (%s)
\n
"
,
name
);
}
else
ok
(
memcmp
(
expect
->
bits
,
converted_bits
,
buffersize
)
==
0
,
"unexpected pixel data (%s)
\n
"
,
name
);
ok
(
compare_bits
(
expect
,
buffersize
,
converted_bits
),
"unexpected pixel data (%s)
\n
"
,
name
);
/* Test with NULL rectangle - should copy the whole bitmap */
memset
(
converted_bits
,
0xaa
,
buffersize
);
hr
=
IWICBitmapSource_CopyPixels
(
source
,
NULL
,
stride
,
buffersize
,
converted_bits
);
ok
(
SUCCEEDED
(
hr
),
"CopyPixels(%s,rc=NULL) failed, hr=%x
\n
"
,
name
,
hr
);
if
(
IsEqualGUID
(
expect
->
format
,
&
GUID_WICPixelFormat32bppBGR
))
{
/* ignore the padding byte when comparing data */
UINT
i
;
BOOL
equal
=
TRUE
;
const
DWORD
*
a
=
(
const
DWORD
*
)
expect
->
bits
,
*
b
=
(
const
DWORD
*
)
converted_bits
;
for
(
i
=
0
;
i
<
(
buffersize
/
4
);
i
++
)
if
((
a
[
i
]
&
0xffffff
)
!=
(
b
[
i
]
&
0xffffff
))
{
equal
=
FALSE
;
break
;
}
ok
(
equal
,
"unexpected pixel data with rc=NULL (%s)
\n
"
,
name
);
}
else
ok
(
memcmp
(
expect
->
bits
,
converted_bits
,
buffersize
)
==
0
,
"unexpected pixel data with rc=NULL (%s)
\n
"
,
name
);
ok
(
compare_bits
(
expect
,
buffersize
,
converted_bits
),
"unexpected pixel data (%s)
\n
"
,
name
);
HeapFree
(
GetProcessHeap
(),
0
,
converted_bits
);
}
...
...
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