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
71325800
Commit
71325800
authored
Jul 07, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
Jul 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Add tests for GdipPlayMetafileRecord.
parent
351a78bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
17 deletions
+127
-17
metafile.c
dlls/gdiplus/tests/metafile.c
+127
-17
No files found.
dlls/gdiplus/tests/metafile.c
View file @
71325800
...
...
@@ -29,6 +29,7 @@ typedef struct emfplus_record
{
ULONG
todo
;
ULONG
record_type
;
ULONG
playback_todo
;
}
emfplus_record
;
typedef
struct
emfplus_check_state
...
...
@@ -36,6 +37,7 @@ typedef struct emfplus_check_state
const
char
*
desc
;
int
count
;
const
struct
emfplus_record
*
expected
;
GpMetafile
*
metafile
;
}
emfplus_check_state
;
static
void
check_record
(
int
count
,
const
char
*
desc
,
const
struct
emfplus_record
*
expected
,
const
struct
emfplus_record
*
actual
)
...
...
@@ -178,6 +180,7 @@ static void check_metafile(GpMetafile *metafile, const emfplus_record *expected,
state
.
desc
=
desc
;
state
.
count
=
0
;
state
.
expected
=
expected
;
state
.
metafile
=
metafile
;
hdc
=
CreateCompatibleDC
(
0
);
...
...
@@ -198,6 +201,51 @@ static void check_metafile(GpMetafile *metafile, const emfplus_record *expected,
DeleteDC
(
hdc
);
}
static
BOOL
CALLBACK
play_metafile_proc
(
EmfPlusRecordType
record_type
,
unsigned
int
flags
,
unsigned
int
dataSize
,
const
unsigned
char
*
pStr
,
void
*
userdata
)
{
emfplus_check_state
*
state
=
(
emfplus_check_state
*
)
userdata
;
GpStatus
stat
;
stat
=
GdipPlayMetafileRecord
(
state
->
metafile
,
record_type
,
flags
,
dataSize
,
pStr
);
if
(
state
->
expected
[
state
->
count
].
record_type
)
{
if
(
state
->
expected
[
state
->
count
].
playback_todo
)
todo_wine
ok
(
stat
==
Ok
,
"%s: GdipPlayMetafileRecord failed with stat %i
\n
"
,
state
->
desc
,
stat
);
else
ok
(
stat
==
Ok
,
"%s: GdipPlayMetafileRecord failed with stat %i
\n
"
,
state
->
desc
,
stat
);
state
->
count
++
;
}
else
{
if
(
state
->
expected
[
state
->
count
].
playback_todo
)
todo_wine
ok
(
0
,
"%s: too many records
\n
"
,
state
->
desc
);
else
ok
(
0
,
"%s: too many records
\n
"
,
state
->
desc
);
return
FALSE
;
}
return
TRUE
;
}
static
void
play_metafile
(
GpMetafile
*
metafile
,
GpGraphics
*
graphics
,
const
emfplus_record
*
expected
,
const
char
*
desc
,
const
GpPointF
*
dst_points
,
const
GpRectF
*
src_rect
,
Unit
src_unit
)
{
GpStatus
stat
;
emfplus_check_state
state
;
state
.
desc
=
desc
;
state
.
count
=
0
;
state
.
expected
=
expected
;
state
.
metafile
=
metafile
;
stat
=
GdipEnumerateMetafileSrcRectDestPoints
(
graphics
,
metafile
,
dst_points
,
3
,
src_rect
,
src_unit
,
play_metafile_proc
,
&
state
,
NULL
);
expect
(
Ok
,
stat
);
}
static
const
emfplus_record
empty_records
[]
=
{
{
0
,
EMR_HEADER
},
{
0
,
EmfPlusRecordTypeHeader
},
...
...
@@ -276,16 +324,16 @@ static void test_empty(void)
}
static
const
emfplus_record
getdc_records
[]
=
{
{
0
,
EMR_HEADER
},
{
0
,
EmfPlusRecordTypeHeader
},
{
0
,
EmfPlusRecordTypeGetDC
},
{
0
,
EMR_CREATEBRUSHINDIRECT
},
{
0
,
EMR_SELECTOBJECT
},
{
0
,
EMR_RECTANGLE
},
{
0
,
EMR_SELECTOBJECT
},
{
0
,
EMR_DELETEOBJECT
},
{
0
,
EmfPlusRecordTypeEndOfFile
},
{
0
,
EMR_EOF
},
{
0
,
EMR_HEADER
,
1
},
{
0
,
EmfPlusRecordTypeHeader
,
1
},
{
0
,
EmfPlusRecordTypeGetDC
,
1
},
{
0
,
EMR_CREATEBRUSHINDIRECT
,
1
},
{
0
,
EMR_SELECTOBJECT
,
1
},
{
0
,
EMR_RECTANGLE
,
1
},
{
0
,
EMR_SELECTOBJECT
,
1
},
{
0
,
EMR_DELETEOBJECT
,
1
},
{
0
,
EmfPlusRecordTypeEndOfFile
,
1
},
{
0
,
EMR_EOF
,
1
},
{
0
}
};
...
...
@@ -299,8 +347,11 @@ static void test_getdc(void)
BOOL
ret
;
static
const
GpRectF
frame
=
{
0
.
0
,
0
.
0
,
100
.
0
,
100
.
0
};
static
const
GpPointF
dst_points
[
3
]
=
{{
0
.
0
,
0
.
0
},{
100
.
0
,
0
.
0
},{
0
.
0
,
100
.
0
}};
static
const
GpPointF
dst_points_half
[
3
]
=
{{
0
.
0
,
0
.
0
},{
50
.
0
,
0
.
0
},{
0
.
0
,
50
.
0
}};
static
const
WCHAR
description
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
HBRUSH
hbrush
,
holdbrush
;
GpBitmap
*
bitmap
;
ARGB
color
;
hdc
=
CreateCompatibleDC
(
0
);
...
...
@@ -346,6 +397,41 @@ static void test_getdc(void)
check_metafile
(
metafile
,
getdc_records
,
"getdc metafile"
,
dst_points
,
&
frame
,
UnitPixel
);
stat
=
GdipCreateBitmapFromScan0
(
100
,
100
,
0
,
PixelFormat32bppARGB
,
NULL
,
&
bitmap
);
expect
(
Ok
,
stat
);
stat
=
GdipGetImageGraphicsContext
((
GpImage
*
)
bitmap
,
&
graphics
);
expect
(
Ok
,
stat
);
play_metafile
(
metafile
,
graphics
,
getdc_records
,
"getdc playback"
,
dst_points
,
&
frame
,
UnitPixel
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
15
,
15
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
50
,
50
,
&
color
);
expect
(
Ok
,
stat
);
todo_wine
expect
(
0xff0000ff
,
color
);
stat
=
GdipBitmapSetPixel
(
bitmap
,
50
,
50
,
0
);
expect
(
Ok
,
stat
);
play_metafile
(
metafile
,
graphics
,
getdc_records
,
"getdc playback"
,
dst_points_half
,
&
frame
,
UnitPixel
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
15
,
15
,
&
color
);
expect
(
Ok
,
stat
);
todo_wine
expect
(
0xff0000ff
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
50
,
50
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0
,
color
);
stat
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
stat
);
stat
=
GdipDisposeImage
((
GpImage
*
)
bitmap
);
expect
(
Ok
,
stat
);
stat
=
GdipGetHemfFromMetafile
(
metafile
,
&
hemf
);
expect
(
Ok
,
stat
);
...
...
@@ -359,13 +445,13 @@ static void test_getdc(void)
}
static
const
emfplus_record
emfonly_records
[]
=
{
{
0
,
EMR_HEADER
},
{
0
,
EMR_CREATEBRUSHINDIRECT
},
{
0
,
EMR_SELECTOBJECT
},
{
0
,
EMR_RECTANGLE
},
{
0
,
EMR_SELECTOBJECT
},
{
0
,
EMR_DELETEOBJECT
},
{
0
,
EMR_EOF
},
{
0
,
EMR_HEADER
,
1
},
{
0
,
EMR_CREATEBRUSHINDIRECT
,
1
},
{
0
,
EMR_SELECTOBJECT
,
1
},
{
0
,
EMR_RECTANGLE
,
1
},
{
0
,
EMR_SELECTOBJECT
,
1
},
{
0
,
EMR_DELETEOBJECT
,
1
},
{
0
,
EMR_EOF
,
1
},
{
0
}
};
...
...
@@ -381,6 +467,8 @@ static void test_emfonly(void)
static
const
GpPointF
dst_points
[
3
]
=
{{
0
.
0
,
0
.
0
},{
100
.
0
,
0
.
0
},{
0
.
0
,
100
.
0
}};
static
const
WCHAR
description
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
HBRUSH
hbrush
,
holdbrush
;
GpBitmap
*
bitmap
;
ARGB
color
;
hdc
=
CreateCompatibleDC
(
0
);
...
...
@@ -426,6 +514,28 @@ static void test_emfonly(void)
check_metafile
(
metafile
,
emfonly_records
,
"emfonly metafile"
,
dst_points
,
&
frame
,
UnitPixel
);
stat
=
GdipCreateBitmapFromScan0
(
100
,
100
,
0
,
PixelFormat32bppARGB
,
NULL
,
&
bitmap
);
expect
(
Ok
,
stat
);
stat
=
GdipGetImageGraphicsContext
((
GpImage
*
)
bitmap
,
&
graphics
);
expect
(
Ok
,
stat
);
play_metafile
(
metafile
,
graphics
,
emfonly_records
,
"emfonly playback"
,
dst_points
,
&
frame
,
UnitPixel
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
15
,
15
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
50
,
50
,
&
color
);
expect
(
Ok
,
stat
);
todo_wine
expect
(
0xff0000ff
,
color
);
stat
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
stat
);
stat
=
GdipDisposeImage
((
GpImage
*
)
bitmap
);
expect
(
Ok
,
stat
);
stat
=
GdipGetHemfFromMetafile
(
metafile
,
&
hemf
);
expect
(
Ok
,
stat
);
...
...
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