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
3eb49955
Commit
3eb49955
authored
Sep 24, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Sep 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Add some tests for palette in a multiframe GIF image.
parent
54800a80
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
122 additions
and
0 deletions
+122
-0
gifformat.c
dlls/windowscodecs/tests/gifformat.c
+122
-0
No files found.
dlls/windowscodecs/tests/gifformat.c
View file @
3eb49955
...
...
@@ -33,6 +33,20 @@ static const char gif_global_palette[] = {
0x02
,
0x02
,
0x44
,
0x01
,
0x00
,
0x3b
};
/* frame 0, GCE transparent index 1
* frame 1, GCE transparent index 2
*/
static
const
char
gif_global_palette_2frames
[]
=
{
/* LSD */
'G'
,
'I'
,
'F'
,
'8'
,
'9'
,
'a'
,
0x01
,
0x00
,
0x01
,
0x00
,
0xa1
,
0x02
,
0x00
,
/* palette */
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
,
0x09
,
0x0a
,
0x0b
,
0x0c
,
/* GCE */
0x21
,
0xf9
,
0x04
,
0x01
,
0x05
,
0x00
,
0x01
,
0x00
,
/* index 1 */
/* IMD */
0x2c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x01
,
0x00
,
0x00
,
0x02
,
0x02
,
0x44
,
0x01
,
0x00
,
/* GCE */
0x21
,
0xf9
,
0x04
,
0x01
,
0x05
,
0x00
,
0x02
,
0x00
,
/* index 2 */
/* IMD */
0x2c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x01
,
0x00
,
0x00
,
0x02
,
0x02
,
0x44
,
0x01
,
0x00
,
0x3b
};
static
const
char
gif_local_palette
[]
=
{
/* LSD */
'G'
,
'I'
,
'F'
,
'8'
,
'7'
,
'a'
,
0x01
,
0x00
,
0x01
,
0x00
,
0x27
,
0x02
,
0x00
,
/* GCE */
0x21
,
0xf9
,
0x04
,
0x01
,
0x05
,
0x00
,
0x01
,
0x00
,
/* index 1 */
...
...
@@ -147,6 +161,113 @@ todo_wine
IWICBitmapDecoder_Release
(
decoder
);
}
static
void
test_global_gif_palette_2frames
(
void
)
{
HRESULT
hr
;
IWICBitmapDecoder
*
decoder
;
IWICBitmapFrameDecode
*
frame
;
IWICPalette
*
palette
;
GUID
format
;
UINT
count
,
ret
;
WICColor
color
[
256
];
decoder
=
create_decoder
(
gif_global_palette_2frames
,
sizeof
(
gif_global_palette_2frames
));
ok
(
decoder
!=
0
,
"Failed to load GIF image data
\n
"
);
/* active frame 0, GCE transparent index 1 */
hr
=
IWICBitmapDecoder_GetFrame
(
decoder
,
0
,
&
frame
);
ok
(
hr
==
S_OK
,
"GetFrame error %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreatePalette
(
factory
,
&
palette
);
ok
(
hr
==
S_OK
,
"CreatePalette error %#x
\n
"
,
hr
);
/* global palette */
hr
=
IWICBitmapDecoder_CopyPalette
(
decoder
,
palette
);
ok
(
hr
==
S_OK
,
"CopyPalette error %#x
\n
"
,
hr
);
hr
=
IWICPalette_GetColorCount
(
palette
,
&
count
);
ok
(
hr
==
S_OK
,
"GetColorCount error %#x
\n
"
,
hr
);
ok
(
count
==
4
,
"expected 4, got %u
\n
"
,
count
);
hr
=
IWICPalette_GetColors
(
palette
,
count
,
color
,
&
ret
);
ok
(
hr
==
S_OK
,
"GetColors error %#x
\n
"
,
hr
);
ok
(
ret
==
count
,
"expected %u, got %u
\n
"
,
count
,
ret
);
ok
(
color
[
0
]
==
0xff010203
,
"expected 0xff010203, got %#x
\n
"
,
color
[
0
]);
todo_wine
ok
(
color
[
1
]
==
0x00040506
,
"expected 0x00040506, got %#x
\n
"
,
color
[
1
]);
ok
(
color
[
2
]
==
0xff070809
,
"expected 0xff070809, got %#x
\n
"
,
color
[
2
]);
ok
(
color
[
3
]
==
0xff0a0b0c
,
"expected 0xff0a0b0c, got %#x
\n
"
,
color
[
3
]);
/* frame 0 palette */
hr
=
IWICBitmapFrameDecode_GetPixelFormat
(
frame
,
&
format
);
ok
(
hr
==
S_OK
,
"GetPixelFormat error %#x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
format
,
&
GUID_WICPixelFormat8bppIndexed
),
"wrong pixel format %s
\n
"
,
debugstr_guid
(
&
format
));
hr
=
IWICBitmapFrameDecode_CopyPalette
(
frame
,
palette
);
ok
(
hr
==
S_OK
,
"CopyPalette error %#x
\n
"
,
hr
);
hr
=
IWICPalette_GetColorCount
(
palette
,
&
count
);
ok
(
hr
==
S_OK
,
"GetColorCount error %#x
\n
"
,
hr
);
ok
(
count
==
4
,
"expected 4, got %u
\n
"
,
count
);
hr
=
IWICPalette_GetColors
(
palette
,
count
,
color
,
&
ret
);
ok
(
hr
==
S_OK
,
"GetColors error %#x
\n
"
,
hr
);
ok
(
ret
==
count
,
"expected %u, got %u
\n
"
,
count
,
ret
);
ok
(
color
[
0
]
==
0xff010203
,
"expected 0xff010203, got %#x
\n
"
,
color
[
0
]);
ok
(
color
[
1
]
==
0x00040506
,
"expected 0x00040506, got %#x
\n
"
,
color
[
1
]);
ok
(
color
[
2
]
==
0xff070809
,
"expected 0xff070809, got %#x
\n
"
,
color
[
2
]);
ok
(
color
[
3
]
==
0xff0a0b0c
,
"expected 0xff0a0b0c, got %#x
\n
"
,
color
[
3
]);
IWICBitmapFrameDecode_Release
(
frame
);
/* active frame 1, GCE transparent index 2 */
hr
=
IWICBitmapDecoder_GetFrame
(
decoder
,
1
,
&
frame
);
ok
(
hr
==
S_OK
,
"GetFrame error %#x
\n
"
,
hr
);
/* global palette */
hr
=
IWICBitmapDecoder_CopyPalette
(
decoder
,
palette
);
ok
(
hr
==
S_OK
,
"CopyPalette error %#x
\n
"
,
hr
);
hr
=
IWICPalette_GetColorCount
(
palette
,
&
count
);
ok
(
hr
==
S_OK
,
"GetColorCount error %#x
\n
"
,
hr
);
ok
(
count
==
4
,
"expected 4, got %u
\n
"
,
count
);
hr
=
IWICPalette_GetColors
(
palette
,
count
,
color
,
&
ret
);
ok
(
hr
==
S_OK
,
"GetColors error %#x
\n
"
,
hr
);
ok
(
ret
==
count
,
"expected %u, got %u
\n
"
,
count
,
ret
);
ok
(
color
[
0
]
==
0xff010203
,
"expected 0xff010203, got %#x
\n
"
,
color
[
0
]);
ok
(
color
[
1
]
==
0xff040506
||
broken
(
color
[
1
]
==
0x00040506
)
/* XP */
,
"expected 0xff040506, got %#x
\n
"
,
color
[
1
]);
todo_wine
ok
(
color
[
2
]
==
0x00070809
||
broken
(
color
[
2
]
==
0xff070809
)
/* XP */
,
"expected 0x00070809, got %#x
\n
"
,
color
[
2
]);
ok
(
color
[
3
]
==
0xff0a0b0c
,
"expected 0xff0a0b0c, got %#x
\n
"
,
color
[
3
]);
/* frame 1 palette */
hr
=
IWICBitmapFrameDecode_GetPixelFormat
(
frame
,
&
format
);
ok
(
hr
==
S_OK
,
"GetPixelFormat error %#x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
format
,
&
GUID_WICPixelFormat8bppIndexed
),
"wrong pixel format %s
\n
"
,
debugstr_guid
(
&
format
));
hr
=
IWICBitmapFrameDecode_CopyPalette
(
frame
,
palette
);
ok
(
hr
==
S_OK
,
"CopyPalette error %#x
\n
"
,
hr
);
hr
=
IWICPalette_GetColorCount
(
palette
,
&
count
);
ok
(
hr
==
S_OK
,
"GetColorCount error %#x
\n
"
,
hr
);
ok
(
count
==
4
,
"expected 4, got %u
\n
"
,
count
);
hr
=
IWICPalette_GetColors
(
palette
,
count
,
color
,
&
ret
);
ok
(
hr
==
S_OK
,
"GetColors error %#x
\n
"
,
hr
);
ok
(
ret
==
count
,
"expected %u, got %u
\n
"
,
count
,
ret
);
ok
(
color
[
0
]
==
0xff010203
,
"expected 0xff010203, got %#x
\n
"
,
color
[
0
]);
ok
(
color
[
1
]
==
0xff040506
,
"expected 0xff040506, got %#x
\n
"
,
color
[
1
]);
ok
(
color
[
2
]
==
0x00070809
,
"expected 0x00070809, got %#x
\n
"
,
color
[
2
]);
ok
(
color
[
3
]
==
0xff0a0b0c
,
"expected 0xff0a0b0c, got %#x
\n
"
,
color
[
3
]);
IWICPalette_Release
(
palette
);
IWICBitmapFrameDecode_Release
(
frame
);
IWICBitmapDecoder_Release
(
decoder
);
}
static
void
test_local_gif_palette
(
void
)
{
HRESULT
hr
;
...
...
@@ -208,6 +329,7 @@ START_TEST(gifformat)
if
(
FAILED
(
hr
))
return
;
test_global_gif_palette
();
test_global_gif_palette_2frames
();
test_local_gif_palette
();
IWICImagingFactory_Release
(
factory
);
...
...
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