Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stefan Dösinger
wine
Commits
dd5a9a0a
Commit
dd5a9a0a
authored
15 years ago
by
Esme Povirk
Committed by
Alexandre Julliard
15 years ago
Browse files
Options
Downloads
Patches
Plain Diff
windowscodecs: Add test for IWICPalette.
parent
3cf9d949
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/windowscodecs/tests/Makefile.in
+2
-1
2 additions, 1 deletion
dlls/windowscodecs/tests/Makefile.in
dlls/windowscodecs/tests/palette.c
+158
-0
158 additions, 0 deletions
dlls/windowscodecs/tests/palette.c
with
160 additions
and
1 deletion
dlls/windowscodecs/tests/Makefile.in
+
2
−
1
View file @
dd5a9a0a
...
...
@@ -6,7 +6,8 @@ TESTDLL = windowscodecs.dll
IMPORTS
=
kernel32 ole32
CTESTS
=
\
bmpformat.c
bmpformat.c
\
palette.c
@MAKE_TEST_RULES@
...
...
This diff is collapsed.
Click to expand it.
dlls/windowscodecs/tests/palette.c
0 → 100644
+
158
−
0
View file @
dd5a9a0a
/*
* Copyright 2009 Vincent Povirk for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include
<stdarg.h>
#define COBJMACROS
#include
"windef.h"
#include
"objbase.h"
#include
"wincodec.h"
#include
"wine/test.h"
static
void
test_custom_palette
(
void
)
{
IWICImagingFactory
*
factory
;
IWICPalette
*
palette
;
HRESULT
hr
;
WICBitmapPaletteType
type
=
0xffffffff
;
UINT
count
=
1
;
const
WICColor
initcolors
[
4
]
=
{
0xff000000
,
0xff0000ff
,
0xffffff00
,
0xffffffff
};
WICColor
colors
[
4
];
BOOL
boolresult
;
hr
=
CoCreateInstance
(
&
CLSID_WICImagingFactory
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWICImagingFactory
,
(
void
**
)
&
factory
);
ok
(
SUCCEEDED
(
hr
),
"CoCreateInstance failed, hr=%x
\n
"
,
hr
);
if
(
!
SUCCEEDED
(
hr
))
return
;
hr
=
IWICImagingFactory_CreatePalette
(
factory
,
&
palette
);
ok
(
SUCCEEDED
(
hr
),
"CreatePalette failed, hr=%x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IWICPalette_GetType
(
palette
,
&
type
);
ok
(
SUCCEEDED
(
hr
),
"GetType failed, hr=%x
\n
"
,
hr
);
ok
(
type
==
WICBitmapPaletteTypeCustom
,
"expected WICBitmapPaletteTypeCustom, got %x
\n
"
,
type
);
hr
=
IWICPalette_GetColorCount
(
palette
,
&
count
);
ok
(
SUCCEEDED
(
hr
),
"GetColorCount failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
0
,
"expected 0, got %u
\n
"
,
count
);
hr
=
IWICPalette_GetColors
(
palette
,
0
,
colors
,
&
count
);
ok
(
SUCCEEDED
(
hr
),
"GetColors failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
0
,
"expected 0, got %u
\n
"
,
count
);
hr
=
IWICPalette_GetColors
(
palette
,
4
,
colors
,
&
count
);
ok
(
SUCCEEDED
(
hr
),
"GetColors failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
0
,
"expected 0, got %u
\n
"
,
count
);
memcpy
(
colors
,
initcolors
,
sizeof
(
initcolors
));
hr
=
IWICPalette_InitializeCustom
(
palette
,
colors
,
4
);
ok
(
SUCCEEDED
(
hr
),
"InitializeCustom failed, hr=%x
\n
"
,
hr
);
hr
=
IWICPalette_GetType
(
palette
,
&
type
);
ok
(
SUCCEEDED
(
hr
),
"GetType failed, hr=%x
\n
"
,
hr
);
ok
(
type
==
WICBitmapPaletteTypeCustom
,
"expected WICBitmapPaletteTypeCustom, got %x
\n
"
,
type
);
hr
=
IWICPalette_GetColorCount
(
palette
,
&
count
);
ok
(
SUCCEEDED
(
hr
),
"GetColorCount failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
4
,
"expected 4, got %u
\n
"
,
count
);
memset
(
colors
,
0
,
sizeof
(
colors
));
count
=
0
;
hr
=
IWICPalette_GetColors
(
palette
,
4
,
colors
,
&
count
);
ok
(
SUCCEEDED
(
hr
),
"GetColors failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
4
,
"expected 4, got %u
\n
"
,
count
);
ok
(
!
memcmp
(
colors
,
initcolors
,
sizeof
(
colors
)),
"got unexpected palette data
\n
"
);
memset
(
colors
,
0
,
sizeof
(
colors
));
count
=
0
;
hr
=
IWICPalette_GetColors
(
palette
,
2
,
colors
,
&
count
);
ok
(
SUCCEEDED
(
hr
),
"GetColors failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
2
,
"expected 2, got %u
\n
"
,
count
);
ok
(
!
memcmp
(
colors
,
initcolors
,
sizeof
(
WICColor
)
*
2
),
"got unexpected palette data
\n
"
);
count
=
0
;
hr
=
IWICPalette_GetColors
(
palette
,
6
,
colors
,
&
count
);
ok
(
SUCCEEDED
(
hr
),
"GetColors failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
4
,
"expected 4, got %u
\n
"
,
count
);
hr
=
IWICPalette_HasAlpha
(
palette
,
&
boolresult
);
ok
(
SUCCEEDED
(
hr
),
"HasAlpha failed, hr=%x
\n
"
,
hr
);
ok
(
!
boolresult
,
"expected FALSE, got TRUE
\n
"
);
hr
=
IWICPalette_IsBlackWhite
(
palette
,
&
boolresult
);
ok
(
SUCCEEDED
(
hr
),
"IsBlackWhite failed, hr=%x
\n
"
,
hr
);
ok
(
!
boolresult
,
"expected FALSE, got TRUE
\n
"
);
hr
=
IWICPalette_IsGrayscale
(
palette
,
&
boolresult
);
ok
(
SUCCEEDED
(
hr
),
"IsGrayscale failed, hr=%x
\n
"
,
hr
);
ok
(
!
boolresult
,
"expected FALSE, got TRUE
\n
"
);
/* try a palette with some alpha in it */
colors
[
2
]
=
0x80ffffff
;
hr
=
IWICPalette_InitializeCustom
(
palette
,
colors
,
4
);
ok
(
SUCCEEDED
(
hr
),
"InitializeCustom failed, hr=%x
\n
"
,
hr
);
hr
=
IWICPalette_HasAlpha
(
palette
,
&
boolresult
);
ok
(
SUCCEEDED
(
hr
),
"HasAlpha failed, hr=%x
\n
"
,
hr
);
ok
(
boolresult
,
"expected TRUE, got FALSE
\n
"
);
/* setting to a 0-color palette is acceptable */
hr
=
IWICPalette_InitializeCustom
(
palette
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"InitializeCustom failed, hr=%x
\n
"
,
hr
);
/* IWICPalette is paranoid about NULL pointers */
hr
=
IWICPalette_GetType
(
palette
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %x
\n
"
,
hr
);
hr
=
IWICPalette_GetColorCount
(
palette
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %x
\n
"
,
hr
);
hr
=
IWICPalette_InitializeCustom
(
palette
,
NULL
,
4
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %x
\n
"
,
hr
);
hr
=
IWICPalette_GetColors
(
palette
,
4
,
NULL
,
&
count
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %x
\n
"
,
hr
);
hr
=
IWICPalette_GetColors
(
palette
,
4
,
colors
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %x
\n
"
,
hr
);
hr
=
IWICPalette_HasAlpha
(
palette
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %x
\n
"
,
hr
);
hr
=
IWICPalette_IsBlackWhite
(
palette
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %x
\n
"
,
hr
);
hr
=
IWICPalette_IsGrayscale
(
palette
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %x
\n
"
,
hr
);
IWICPalette_Release
(
palette
);
}
IWICImagingFactory_Release
(
factory
);
}
START_TEST
(
palette
)
{
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
test_custom_palette
();
CoUninitialize
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment