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
757012cd
Commit
757012cd
authored
Jan 26, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
Jan 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Test the types of records in an empty EMF+.
parent
a06b4bc5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
125 additions
and
0 deletions
+125
-0
metafile.c
dlls/gdiplus/tests/metafile.c
+125
-0
gdiplusenums.h
include/gdiplusenums.h
+0
-0
No files found.
dlls/gdiplus/tests/metafile.c
View file @
757012cd
...
...
@@ -25,6 +25,129 @@
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
typedef
struct
emfplus_record
{
ULONG
todo
;
ULONG
record_type
;
int
is_emfplus
;
}
emfplus_record
;
typedef
struct
emfplus_check_state
{
const
char
*
desc
;
int
count
;
const
struct
emfplus_record
*
expected
;
}
emfplus_check_state
;
static
void
check_record
(
int
count
,
const
char
*
desc
,
const
struct
emfplus_record
*
expected
,
const
struct
emfplus_record
*
actual
)
{
ok
(
expected
->
record_type
==
actual
->
record_type
,
"%s.%i: Expected record type 0x%x, got 0x%x
\n
"
,
desc
,
count
,
expected
->
record_type
,
actual
->
record_type
);
ok
(
expected
->
is_emfplus
==
actual
->
is_emfplus
,
"%s.%i: Expected is_emfplus %i, got %i
\n
"
,
desc
,
count
,
expected
->
record_type
,
actual
->
record_type
);
}
typedef
struct
EmfPlusRecordHeader
{
WORD
Type
;
WORD
Flags
;
DWORD
Size
;
DWORD
DataSize
;
}
EmfPlusRecordHeader
;
static
int
CALLBACK
enum_emf_proc
(
HDC
hDC
,
HANDLETABLE
*
lpHTable
,
const
ENHMETARECORD
*
lpEMFR
,
int
nObj
,
LPARAM
lpData
)
{
emfplus_check_state
*
state
=
(
emfplus_check_state
*
)
lpData
;
emfplus_record
actual
;
if
(
lpEMFR
->
iType
==
EMR_GDICOMMENT
)
{
const
EMRGDICOMMENT
*
comment
=
(
const
EMRGDICOMMENT
*
)
lpEMFR
;
if
(
comment
->
cbData
>=
4
&&
memcmp
(
comment
->
Data
,
"EMF+"
,
4
)
==
0
)
{
int
offset
=
4
;
while
(
offset
+
sizeof
(
EmfPlusRecordHeader
)
<=
comment
->
cbData
)
{
const
EmfPlusRecordHeader
*
record
=
(
const
EmfPlusRecordHeader
*
)
&
comment
->
Data
[
offset
];
ok
(
record
->
Size
==
record
->
DataSize
+
sizeof
(
EmfPlusRecordHeader
),
"%s: EMF+ record datasize %u and size %u mismatch
\n
"
,
state
->
desc
,
record
->
DataSize
,
record
->
Size
);
ok
(
offset
+
record
->
DataSize
<=
comment
->
cbData
,
"%s: EMF+ record truncated
\n
"
,
state
->
desc
);
if
(
offset
+
record
->
DataSize
>
comment
->
cbData
)
return
0
;
if
(
state
->
expected
[
state
->
count
].
record_type
)
{
actual
.
todo
=
0
;
actual
.
record_type
=
record
->
Type
;
actual
.
is_emfplus
=
1
;
check_record
(
state
->
count
,
state
->
desc
,
&
state
->
expected
[
state
->
count
],
&
actual
);
state
->
count
++
;
}
else
{
ok
(
0
,
"%s: Unexpected EMF+ 0x%x record
\n
"
,
state
->
desc
,
record
->
Type
);
}
offset
+=
record
->
Size
;
}
ok
(
offset
==
comment
->
cbData
,
"%s: truncated EMF+ record data?
\n
"
,
state
->
desc
);
return
1
;
}
}
if
(
state
->
expected
[
state
->
count
].
record_type
)
{
actual
.
todo
=
0
;
actual
.
record_type
=
lpEMFR
->
iType
;
actual
.
is_emfplus
=
0
;
check_record
(
state
->
count
,
state
->
desc
,
&
state
->
expected
[
state
->
count
],
&
actual
);
state
->
count
++
;
}
else
{
ok
(
0
,
"%s: Unexpected EMF 0x%x record
\n
"
,
state
->
desc
,
lpEMFR
->
iType
);
}
return
1
;
}
static
void
check_emfplus
(
HENHMETAFILE
hemf
,
const
emfplus_record
*
expected
,
const
char
*
desc
)
{
emfplus_check_state
state
;
state
.
desc
=
desc
;
state
.
count
=
0
;
state
.
expected
=
expected
;
EnumEnhMetaFile
(
0
,
hemf
,
enum_emf_proc
,
&
state
,
NULL
);
ok
(
expected
[
state
.
count
].
record_type
==
0
,
"%s: Got %i records, expecting more
\n
"
,
desc
,
state
.
count
);
}
static
const
emfplus_record
empty_records
[]
=
{
{
0
,
EMR_HEADER
,
0
},
{
0
,
EmfPlusRecordTypeHeader
,
1
},
{
0
,
EmfPlusRecordTypeEndOfFile
,
1
},
{
0
,
EMR_EOF
,
0
},
{
0
}
};
static
void
test_empty
(
void
)
{
GpStatus
stat
;
...
...
@@ -67,6 +190,8 @@ static void test_empty(void)
stat
=
GdipDisposeImage
((
GpImage
*
)
metafile
);
expect
(
Ok
,
stat
);
check_emfplus
(
hemf
,
empty_records
,
"empty"
);
ret
=
DeleteEnhMetaFile
(
hemf
);
ok
(
ret
!=
0
,
"Failed to delete enhmetafile %p
\n
"
,
hemf
);
}
...
...
include/gdiplusenums.h
View file @
757012cd
This diff is collapsed.
Click to expand it.
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