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
974e8753
Commit
974e8753
authored
Mar 29, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
Apr 11, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Add test for multi-frame TIFF encoding.
parent
0a5b513d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
29 deletions
+67
-29
converter.c
dlls/windowscodecs/tests/converter.c
+67
-29
No files found.
dlls/windowscodecs/tests/converter.c
View file @
974e8753
...
@@ -361,8 +361,8 @@ static void test_default_converter(void)
...
@@ -361,8 +361,8 @@ static void test_default_converter(void)
DeleteTestBitmap
(
src_obj
);
DeleteTestBitmap
(
src_obj
);
}
}
static
void
test_
encoder
(
const
struct
bitmap_data
*
src
,
const
CLSID
*
clsid_encoder
,
static
void
test_
multi_encoder
(
const
struct
bitmap_data
**
srcs
,
const
CLSID
*
clsid_encoder
,
const
struct
bitmap_data
*
dst
,
const
CLSID
*
clsid_decoder
,
const
char
*
name
)
const
struct
bitmap_data
*
*
dsts
,
const
CLSID
*
clsid_decoder
,
const
char
*
name
)
{
{
HRESULT
hr
;
HRESULT
hr
;
IWICBitmapEncoder
*
encoder
;
IWICBitmapEncoder
*
encoder
;
...
@@ -374,8 +374,7 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
...
@@ -374,8 +374,7 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
IWICBitmapDecoder
*
decoder
;
IWICBitmapDecoder
*
decoder
;
IWICBitmapFrameDecode
*
framedecode
;
IWICBitmapFrameDecode
*
framedecode
;
WICPixelFormatGUID
pixelformat
;
WICPixelFormatGUID
pixelformat
;
int
i
;
CreateTestBitmap
(
src
,
&
src_obj
);
hr
=
CoCreateInstance
(
clsid_encoder
,
NULL
,
CLSCTX_INPROC_SERVER
,
hr
=
CoCreateInstance
(
clsid_encoder
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWICBitmapEncoder
,
(
void
**
)
&
encoder
);
&
IID_IWICBitmapEncoder
,
(
void
**
)
&
encoder
);
...
@@ -395,32 +394,45 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
...
@@ -395,32 +394,45 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
hr
=
IWICBitmapEncoder_Initialize
(
encoder
,
stream
,
WICBitmapEncoderNoCache
);
hr
=
IWICBitmapEncoder_Initialize
(
encoder
,
stream
,
WICBitmapEncoderNoCache
);
ok
(
SUCCEEDED
(
hr
),
"Initialize failed, hr=%x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Initialize failed, hr=%x
\n
"
,
hr
);
hr
=
IWICBitmapEncoder_CreateNewFrame
(
encoder
,
&
frameencode
,
&
options
);
i
=
0
;
ok
(
SUCCEEDED
(
hr
),
"CreateFrame failed, hr=%x
\n
"
,
hr
);
while
(
SUCCEEDED
(
hr
)
&&
srcs
[
i
])
if
(
SUCCEEDED
(
hr
))
{
{
hr
=
IWICBitmapFrameEncode_Initialize
(
frameencode
,
options
);
CreateTestBitmap
(
srcs
[
i
],
&
src_obj
);
ok
(
SUCCEEDED
(
hr
),
"Initialize failed, hr=%x
\n
"
,
hr
);
hr
=
IWICBitmapEncoder_CreateNewFrame
(
encoder
,
&
frameencode
,
&
options
);
ok
(
SUCCEEDED
(
hr
),
"CreateFrame failed, hr=%x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IWICBitmapFrameEncode_Initialize
(
frameencode
,
options
);
ok
(
SUCCEEDED
(
hr
),
"Initialize failed, hr=%x
\n
"
,
hr
);
memcpy
(
&
pixelformat
,
src
->
format
,
sizeof
(
GUID
));
memcpy
(
&
pixelformat
,
srcs
[
i
]
->
format
,
sizeof
(
GUID
));
hr
=
IWICBitmapFrameEncode_SetPixelFormat
(
frameencode
,
&
pixelformat
);
hr
=
IWICBitmapFrameEncode_SetPixelFormat
(
frameencode
,
&
pixelformat
);
ok
(
SUCCEEDED
(
hr
),
"SetPixelFormat failed, hr=%x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SetPixelFormat failed, hr=%x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
pixelformat
,
src
->
format
),
"SetPixelFormat changed the format
\n
"
);
ok
(
IsEqualGUID
(
&
pixelformat
,
srcs
[
i
]
->
format
),
"SetPixelFormat changed the format
\n
"
);
hr
=
IWICBitmapFrameEncode_SetSize
(
frameencode
,
src
->
width
,
src
->
height
);
hr
=
IWICBitmapFrameEncode_SetSize
(
frameencode
,
srcs
[
i
]
->
width
,
srcs
[
i
]
->
height
);
ok
(
SUCCEEDED
(
hr
),
"SetSize failed, hr=%x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"SetSize failed, hr=%x
\n
"
,
hr
);
hr
=
IWICBitmapFrameEncode_WriteSource
(
frameencode
,
&
src_obj
->
IWICBitmapSource_iface
,
NULL
);
hr
=
IWICBitmapFrameEncode_WriteSource
(
frameencode
,
&
src_obj
->
IWICBitmapSource_iface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"WriteSource failed, hr=%x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"WriteSource failed, hr=%x
\n
"
,
hr
);
hr
=
IWICBitmapFrameEncode_Commit
(
frameencode
);
hr
=
IWICBitmapFrameEncode_Commit
(
frameencode
);
ok
(
SUCCEEDED
(
hr
),
"Commit failed, hr=%x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Commit failed, hr=%x
\n
"
,
hr
);
IWICBitmapFrameEncode_Release
(
frameencode
);
IPropertyBag2_Release
(
options
);
}
DeleteTestBitmap
(
src_obj
);
i
++
;
}
if
(
SUCCEEDED
(
hr
))
{
hr
=
IWICBitmapEncoder_Commit
(
encoder
);
hr
=
IWICBitmapEncoder_Commit
(
encoder
);
ok
(
SUCCEEDED
(
hr
),
"Commit failed, hr=%x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Commit failed, hr=%x
\n
"
,
hr
);
IWICBitmapFrameEncode_Release
(
frameencode
);
IPropertyBag2_Release
(
options
);
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
...
@@ -435,14 +447,20 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
...
@@ -435,14 +447,20 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
hr
=
IWICBitmapDecoder_Initialize
(
decoder
,
stream
,
WICDecodeMetadataCacheOnDemand
);
hr
=
IWICBitmapDecoder_Initialize
(
decoder
,
stream
,
WICDecodeMetadataCacheOnDemand
);
ok
(
SUCCEEDED
(
hr
),
"Initialize failed, hr=%x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Initialize failed, hr=%x
\n
"
,
hr
);
hr
=
IWICBitmapDecoder_GetFrame
(
decoder
,
0
,
&
framedecode
);
i
=
0
;
ok
(
SUCCEEDED
(
hr
),
"GetFrame failed, hr=%x
\n
"
,
hr
);
while
(
SUCCEEDED
(
hr
)
&&
dsts
[
i
])
if
(
SUCCEEDED
(
hr
))
{
{
compare_bitmap_data
(
dst
,
(
IWICBitmapSource
*
)
framedecode
,
name
);
hr
=
IWICBitmapDecoder_GetFrame
(
decoder
,
i
,
&
framedecode
);
ok
(
SUCCEEDED
(
hr
),
"GetFrame failed, hr=%x
\n
"
,
hr
);
IWICBitmapFrameDecode_Release
(
framedecode
);
if
(
SUCCEEDED
(
hr
))
{
compare_bitmap_data
(
dsts
[
i
],
(
IWICBitmapSource
*
)
framedecode
,
name
);
IWICBitmapFrameDecode_Release
(
framedecode
);
}
i
++
;
}
}
IWICBitmapDecoder_Release
(
decoder
);
IWICBitmapDecoder_Release
(
decoder
);
...
@@ -453,10 +471,27 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
...
@@ -453,10 +471,27 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
IWICBitmapEncoder_Release
(
encoder
);
IWICBitmapEncoder_Release
(
encoder
);
}
}
}
DeleteTestBitmap
(
src_obj
);
static
void
test_encoder
(
const
struct
bitmap_data
*
src
,
const
CLSID
*
clsid_encoder
,
const
struct
bitmap_data
*
dst
,
const
CLSID
*
clsid_decoder
,
const
char
*
name
)
{
const
struct
bitmap_data
*
srcs
[
2
];
const
struct
bitmap_data
*
dsts
[
2
];
srcs
[
0
]
=
src
;
srcs
[
1
]
=
NULL
;
dsts
[
0
]
=
dst
;
dsts
[
1
]
=
NULL
;
test_multi_encoder
(
srcs
,
clsid_encoder
,
dsts
,
clsid_decoder
,
name
);
}
}
static
const
struct
bitmap_data
*
multiple_frames
[
3
]
=
{
&
testdata_24bppBGR
,
&
testdata_24bppBGR
,
NULL
};
START_TEST
(
converter
)
START_TEST
(
converter
)
{
{
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
...
@@ -476,5 +511,8 @@ START_TEST(converter)
...
@@ -476,5 +511,8 @@ START_TEST(converter)
test_encoder
(
&
testdata_24bppBGR
,
&
CLSID_WICTiffEncoder
,
test_encoder
(
&
testdata_24bppBGR
,
&
CLSID_WICTiffEncoder
,
&
testdata_24bppBGR
,
&
CLSID_WICTiffDecoder
,
"TIFF encoder 24bppBGR"
);
&
testdata_24bppBGR
,
&
CLSID_WICTiffDecoder
,
"TIFF encoder 24bppBGR"
);
test_multi_encoder
(
multiple_frames
,
&
CLSID_WICTiffEncoder
,
multiple_frames
,
&
CLSID_WICTiffDecoder
,
"TIFF encoder multi-frame"
);
CoUninitialize
();
CoUninitialize
();
}
}
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