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
12adc3e1
Commit
12adc3e1
authored
Jul 02, 2009
by
Huw Davies
Committed by
Alexandre Julliard
Jul 02, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add tests for the map mode and window size records.
parent
8edbd063
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
3 deletions
+75
-3
metafile.c
dlls/gdi32/tests/metafile.c
+75
-3
No files found.
dlls/gdi32/tests/metafile.c
View file @
12adc3e1
...
...
@@ -2302,20 +2302,26 @@ static void test_SetWinMetaFileBits(void)
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
static
void
test_GetWinMetaFileBits
(
void
)
static
void
getwinmetafilebits
(
UINT
mode
,
int
scale
)
{
HENHMETAFILE
emf
;
HDC
display_dc
,
emf_dc
;
RECT
rc
;
ENHMETAHEADER
*
enh_header
;
UINT
size
,
emf_size
,
i
,
mode
;
UINT
size
,
emf_size
,
i
;
WORD
check
=
0
;
DWORD
rec_num
=
0
;
METAHEADER
*
mh
;
METARECORD
*
rec
;
INT
horz_res
,
vert_res
,
horz_size
,
vert_size
;
display_dc
=
GetDC
(
NULL
);
horz_res
=
GetDeviceCaps
(
display_dc
,
HORZRES
);
vert_res
=
GetDeviceCaps
(
display_dc
,
VERTRES
);
horz_size
=
GetDeviceCaps
(
display_dc
,
HORZSIZE
);
vert_size
=
GetDeviceCaps
(
display_dc
,
VERTSIZE
);
SetRect
(
&
rc
,
1000
,
2000
,
3000
,
6000
);
emf_dc
=
CreateEnhMetaFileA
(
display_dc
,
NULL
,
&
rc
,
NULL
);
for
(
i
=
0
;
i
<
3000
;
i
++
)
/* This is enough to take emf_size > 0xffff */
...
...
@@ -2325,9 +2331,14 @@ static void test_GetWinMetaFileBits(void)
emf_size
=
GetEnhMetaFileBits
(
emf
,
0
,
NULL
);
enh_header
=
HeapAlloc
(
GetProcessHeap
(),
0
,
emf_size
);
emf_size
=
GetEnhMetaFileBits
(
emf
,
emf_size
,
(
BYTE
*
)
enh_header
);
DeleteEnhMetaFile
(
emf
);
/* multiply szlDevice.cx by scale, when scale != 1 the recording and playback dcs
have different resolutions */
enh_header
->
szlDevice
.
cx
*=
scale
;
emf
=
SetEnhMetaFileBits
(
emf_size
,
(
BYTE
*
)
enh_header
);
mode
=
MM_ANISOTROPIC
;
size
=
GetWinMetaFileBits
(
emf
,
0
,
NULL
,
mode
,
display_dc
);
ok
(
size
,
"GetWinMetaFileBits returns 0
\n
"
);
mh
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
GetWinMetaFileBits
(
emf
,
size
,
(
BYTE
*
)
mh
,
mode
,
display_dc
);
...
...
@@ -2372,6 +2383,56 @@ static void test_GetWinMetaFileBits(void)
ok
(
!
memcmp
(
rec
->
rdParm
+
19
,
(
char
*
)
enh_header
+
rec_num
*
chunk_size
,
this_chunk_size
),
"bits mismatch
\n
"
);
}
else
if
(
rec_num
==
mfcomment_chunks
)
{
ok
(
rec
->
rdFunction
==
META_SETMAPMODE
,
"got %04x
\n
"
,
rec
->
rdFunction
);
ok
(
rec
->
rdParm
[
0
]
==
mode
,
"got %04x
\n
"
,
rec
->
rdParm
[
0
]);
}
else
if
(
rec_num
==
mfcomment_chunks
+
1
)
{
POINT
pt
;
ok
(
rec
->
rdFunction
==
META_SETWINDOWORG
,
"got %04x
\n
"
,
rec
->
rdFunction
);
switch
(
mode
)
{
case
MM_TEXT
:
case
MM_ISOTROPIC
:
case
MM_ANISOTROPIC
:
pt
.
y
=
MulDiv
(
rc
.
top
,
vert_res
,
vert_size
*
100
);
pt
.
x
=
MulDiv
(
rc
.
left
,
horz_res
,
horz_size
*
100
);
break
;
case
MM_LOMETRIC
:
pt
.
y
=
MulDiv
(
-
rc
.
top
,
1
,
10
)
+
1
;
pt
.
x
=
MulDiv
(
rc
.
left
,
1
,
10
);
break
;
case
MM_HIMETRIC
:
pt
.
y
=
-
rc
.
top
+
1
;
pt
.
x
=
rc
.
left
;
break
;
case
MM_LOENGLISH
:
pt
.
y
=
MulDiv
(
-
rc
.
top
,
10
,
254
)
+
1
;
pt
.
x
=
MulDiv
(
rc
.
left
,
10
,
254
);
break
;
case
MM_HIENGLISH
:
pt
.
y
=
MulDiv
(
-
rc
.
top
,
100
,
254
)
+
1
;
pt
.
x
=
MulDiv
(
rc
.
left
,
100
,
254
);
break
;
case
MM_TWIPS
:
pt
.
y
=
MulDiv
(
-
rc
.
top
,
72
*
20
,
2540
)
+
1
;
pt
.
x
=
MulDiv
(
rc
.
left
,
72
*
20
,
2540
);
break
;
default:
pt
.
x
=
pt
.
y
=
0
;
}
ok
((
short
)
rec
->
rdParm
[
0
]
==
pt
.
y
,
"got %d expect %d
\n
"
,
(
short
)
rec
->
rdParm
[
0
],
pt
.
y
);
ok
((
short
)
rec
->
rdParm
[
1
]
==
pt
.
x
,
"got %d expect %d
\n
"
,
(
short
)
rec
->
rdParm
[
1
],
pt
.
x
);
}
if
(
rec_num
==
mfcomment_chunks
+
2
)
{
ok
(
rec
->
rdFunction
==
META_SETWINDOWEXT
,
"got %04x
\n
"
,
rec
->
rdFunction
);
ok
((
short
)
rec
->
rdParm
[
0
]
==
MulDiv
(
rc
.
bottom
-
rc
.
top
,
vert_res
,
vert_size
*
100
),
"got %d
\n
"
,
(
short
)
rec
->
rdParm
[
0
]);
ok
((
short
)
rec
->
rdParm
[
1
]
==
MulDiv
(
rc
.
right
-
rc
.
left
,
horz_res
,
horz_size
*
100
),
"got %d
\n
"
,
(
short
)
rec
->
rdParm
[
1
]);
}
rec_num
++
;
rec
=
(
METARECORD
*
)((
WORD
*
)
rec
+
rec
->
rdSize
);
}
...
...
@@ -2383,6 +2444,17 @@ static void test_GetWinMetaFileBits(void)
ReleaseDC
(
NULL
,
display_dc
);
}
static
void
test_GetWinMetaFileBits
(
void
)
{
UINT
mode
;
for
(
mode
=
MM_MIN
;
mode
<=
MM_MAX
;
mode
++
)
{
getwinmetafilebits
(
mode
,
1
);
getwinmetafilebits
(
mode
,
2
);
}
}
static
BOOL
(
WINAPI
*
pGdiIsMetaPrintDC
)(
HDC
);
static
BOOL
(
WINAPI
*
pGdiIsMetaFileDC
)(
HDC
);
static
BOOL
(
WINAPI
*
pGdiIsPlayMetafileDC
)(
HDC
);
...
...
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