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
b2fa9985
Commit
b2fa9985
authored
Nov 15, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
Nov 16, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Add tests for IWICMetadataReader.
parent
bb42f290
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
202 additions
and
0 deletions
+202
-0
Makefile.in
dlls/windowscodecs/tests/Makefile.in
+1
-0
bmpformat.c
dlls/windowscodecs/tests/bmpformat.c
+1
-0
metadata.c
dlls/windowscodecs/tests/metadata.c
+192
-0
wincodecsdk.idl
include/wincodecsdk.idl
+8
-0
No files found.
dlls/windowscodecs/tests/Makefile.in
View file @
b2fa9985
...
...
@@ -6,6 +6,7 @@ C_SRCS = \
converter.c
\
icoformat.c
\
info.c
\
metadata.c
\
palette.c
\
stream.c
...
...
dlls/windowscodecs/tests/bmpformat.c
View file @
b2fa9985
...
...
@@ -25,6 +25,7 @@
#include "initguid.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wine/test.h"
static
const
char
testbmp_24bpp
[]
=
{
...
...
dlls/windowscodecs/tests/metadata.c
0 → 100644
View file @
b2fa9985
/*
* Copyright 2011 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>
#include <math.h>
#define COBJMACROS
#include "windef.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wine/test.h"
#define expect_blob(propvar, data, length) do { \
ok((propvar).vt == VT_BLOB, "unexpected vt: %i\n", (propvar).vt); \
if ((propvar).vt == VT_BLOB) { \
ok((propvar).blob.cbSize == (length), "expected size %i, got %i\n", (length), (propvar).blob.cbSize); \
if ((propvar).blob.cbSize == (length)) { \
ok(!memcmp((propvar).blob.pBlobData, (data), (length)), "unexpected data\n"); \
} \
} \
} while (0)
static
const
char
metadata_unknown
[]
=
"lalala"
;
static
const
char
metadata_tEXt
[]
=
{
0
,
0
,
0
,
14
,
/* chunk length */
't'
,
'E'
,
'X'
,
't'
,
/* chunk type */
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
,
/* keyword */
'v'
,
'a'
,
'l'
,
'u'
,
'e'
,
/* text */
0x3f
,
0x64
,
0x19
,
0xf3
/* chunk CRC */
};
static
void
load_stream
(
IUnknown
*
reader
,
const
char
*
data
,
int
data_size
)
{
HRESULT
hr
;
IWICPersistStream
*
persist
;
IStream
*
stream
;
HGLOBAL
hdata
;
void
*
locked_data
;
hdata
=
GlobalAlloc
(
GMEM_MOVEABLE
,
data_size
);
ok
(
hdata
!=
0
,
"GlobalAlloc failed
\n
"
);
if
(
!
hdata
)
return
;
locked_data
=
GlobalLock
(
hdata
);
memcpy
(
locked_data
,
data
,
data_size
);
GlobalUnlock
(
hdata
);
hr
=
CreateStreamOnHGlobal
(
hdata
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"CreateStreamOnHGlobal failed, hr=%x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IUnknown_QueryInterface
(
reader
,
&
IID_IWICPersistStream
,
(
void
**
)
&
persist
);
ok
(
hr
==
S_OK
,
"QueryInterface failed, hr=%x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IWICPersistStream_LoadEx
(
persist
,
stream
,
NULL
,
WICPersistOptionsDefault
);
ok
(
hr
==
S_OK
,
"LoadEx failed, hr=%x
\n
"
,
hr
);
IWICPersistStream_Release
(
persist
);
}
IStream_Release
(
stream
);
}
static
void
test_metadata_unknown
(
void
)
{
HRESULT
hr
;
IWICMetadataReader
*
reader
;
IWICEnumMetadataItem
*
enumerator
;
PROPVARIANT
schema
,
id
,
value
;
ULONG
items_returned
;
hr
=
CoCreateInstance
(
&
CLSID_WICUnknownMetadataReader
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWICMetadataReader
,
(
void
**
)
&
reader
);
todo_wine
ok
(
hr
==
S_OK
,
"CoCreateInstance failed, hr=%x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
load_stream
((
IUnknown
*
)
reader
,
metadata_unknown
,
sizeof
(
metadata_unknown
));
hr
=
IWICMetadataReader_GetEnumerator
(
reader
,
&
enumerator
);
ok
(
hr
==
S_OK
,
"GetEnumerator failed, hr=%x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
PropVariantInit
(
&
schema
);
PropVariantInit
(
&
id
);
PropVariantInit
(
&
value
);
hr
=
IWICEnumMetadataItem_Next
(
enumerator
,
1
,
&
schema
,
&
id
,
&
value
,
&
items_returned
);
ok
(
hr
==
S_OK
,
"Next failed, hr=%x
\n
"
,
hr
);
ok
(
items_returned
==
1
,
"unexpected item count %i
\n
"
,
items_returned
);
if
(
hr
==
S_OK
&&
items_returned
==
1
)
{
ok
(
schema
.
vt
==
VT_EMPTY
,
"unexpected vt: %i
\n
"
,
schema
.
vt
);
ok
(
id
.
vt
==
VT_EMPTY
,
"unexpected vt: %i
\n
"
,
id
.
vt
);
expect_blob
(
value
,
metadata_unknown
,
sizeof
(
metadata_unknown
));
PropVariantClear
(
&
schema
);
PropVariantClear
(
&
id
);
PropVariantClear
(
&
value
);
}
hr
=
IWICEnumMetadataItem_Next
(
enumerator
,
1
,
&
schema
,
&
id
,
&
value
,
&
items_returned
);
ok
(
hr
==
S_FALSE
,
"Next failed, hr=%x
\n
"
,
hr
);
ok
(
items_returned
==
0
,
"unexpected item count %i
\n
"
,
items_returned
);
IWICEnumMetadataItem_Release
(
enumerator
);
}
IWICMetadataReader_Release
(
reader
);
}
static
void
test_metadata_tEXt
(
void
)
{
HRESULT
hr
;
IWICMetadataReader
*
reader
;
IWICEnumMetadataItem
*
enumerator
;
PROPVARIANT
schema
,
id
,
value
;
ULONG
items_returned
;
hr
=
CoCreateInstance
(
&
CLSID_WICPngTextMetadataReader
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWICMetadataReader
,
(
void
**
)
&
reader
);
todo_wine
ok
(
hr
==
S_OK
,
"CoCreateInstance failed, hr=%x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
load_stream
((
IUnknown
*
)
reader
,
metadata_tEXt
,
sizeof
(
metadata_tEXt
));
hr
=
IWICMetadataReader_GetEnumerator
(
reader
,
&
enumerator
);
ok
(
hr
==
S_OK
,
"GetEnumerator failed, hr=%x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
PropVariantInit
(
&
schema
);
PropVariantInit
(
&
id
);
PropVariantInit
(
&
value
);
hr
=
IWICEnumMetadataItem_Next
(
enumerator
,
1
,
&
schema
,
&
id
,
&
value
,
&
items_returned
);
ok
(
hr
==
S_OK
,
"Next failed, hr=%x
\n
"
,
hr
);
ok
(
items_returned
==
1
,
"unexpected item count %i
\n
"
,
items_returned
);
if
(
hr
==
S_OK
&&
items_returned
==
1
)
{
ok
(
schema
.
vt
==
VT_EMPTY
,
"unexpected vt: %i
\n
"
,
schema
.
vt
);
ok
(
id
.
vt
==
VT_LPSTR
,
"unexpected vt: %i
\n
"
,
id
.
vt
);
ok
(
!
strcmp
(
id
.
pszVal
,
"winetest"
),
"unexpected id: %s
\n
"
,
id
.
pszVal
);
ok
(
value
.
vt
==
VT_LPSTR
,
"unexpected vt: %i
\n
"
,
id
.
vt
);
ok
(
!
strcmp
(
value
.
pszVal
,
"value"
),
"unexpected value: %s
\n
"
,
id
.
pszVal
);
PropVariantClear
(
&
schema
);
PropVariantClear
(
&
id
);
PropVariantClear
(
&
value
);
}
hr
=
IWICEnumMetadataItem_Next
(
enumerator
,
1
,
&
schema
,
&
id
,
&
value
,
&
items_returned
);
ok
(
hr
==
S_FALSE
,
"Next failed, hr=%x
\n
"
,
hr
);
ok
(
items_returned
==
0
,
"unexpected item count %i
\n
"
,
items_returned
);
IWICEnumMetadataItem_Release
(
enumerator
);
}
IWICMetadataReader_Release
(
reader
);
}
START_TEST
(
metadata
)
{
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
test_metadata_unknown
();
test_metadata_tEXt
();
CoUninitialize
();
}
include/wincodecsdk.idl
View file @
b2fa9985
...
...
@@ -34,6 +34,14 @@ typedef enum WICMetadataCreationOptions {
WICMetadataCreationMask
=
0
xFFFF0000
}
WICMetadataCreationOptions
;
cpp_quote
(
"DEFINE_GUID(GUID_MetadataFormatUnknown, 0xa45e592f,0x9078,0x4a7c,0xad,0xb5,0x4e,0xdc,0x4f,0xd6,0x1b,0x1f);"
)
cpp_quote
(
"DEFINE_GUID(GUID_MetadataFormatChunktEXt, 0x568d8936,0xc0a9,0x4923,0x90,0x5d,0xdf,0x2b,0x38,0x23,0x8f,0xbc);"
)
cpp_quote
(
"DEFINE_GUID(CLSID_WICUnknownMetadataReader, 0x699745c2,0x5066,0x4b82,0xa8,0xe3,0xd4,0x04,0x78,0xdb,0xec,0x8c);"
)
cpp_quote
(
"DEFINE_GUID(CLSID_WICUnknownMetadataWriter, 0xa09cca86,0x27ba,0x4f39,0x90,0x53,0x12,0x1f,0xa4,0xdc,0x08,0xfc);"
)
cpp_quote
(
"DEFINE_GUID(CLSID_WICPngTextMetadataReader, 0x4b59afcc,0xb8c3,0x408a,0xb6,0x70,0x89,0xe5,0xfa,0xb6,0xfd,0xa7);"
)
cpp_quote
(
"DEFINE_GUID(CLSID_WICPngTextMetadataWriter, 0xb5ebafb9,0x253e,0x4a72,0xa7,0x44,0x07,0x62,0xd2,0x68,0x56,0x83);"
)
[
object
,
uuid
(
aba958bf
-
c672
-
44
d1
-
8
d61
-
ce6df2e682c2
)
...
...
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