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
2e8bf70f
Commit
2e8bf70f
authored
Oct 18, 2005
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Oct 18, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for CopyMetaFile, make it pass under Wine.
parent
0be88a04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
4 deletions
+58
-4
metafile.c
dlls/gdi/metafile.c
+0
-3
metafile.c
dlls/gdi/tests/metafile.c
+58
-1
No files found.
dlls/gdi/metafile.c
View file @
2e8bf70f
...
...
@@ -379,12 +379,10 @@ static METAHEADER *MF_LoadDiskBasedMetaFile(METAHEADER *mh)
METAHEADER
*
MF_CreateMetaHeaderDisk
(
METAHEADER
*
mh
,
LPCVOID
filename
,
BOOL
uni
)
{
METAHEADERDISK
*
mhd
;
DWORD
size
;
mh
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
mh
,
sizeof
(
METAHEADER
)
+
sizeof
(
METAHEADERDISK
));
mh
->
mtType
=
METAFILE_DISK
;
size
=
HeapSize
(
GetProcessHeap
(),
0
,
mh
);
mhd
=
(
METAHEADERDISK
*
)((
char
*
)
mh
+
sizeof
(
METAHEADER
));
if
(
uni
)
...
...
@@ -475,7 +473,6 @@ HMETAFILE WINAPI CopyMetaFileW( HMETAFILE hSrcMetaFile, LPCWSTR lpFilename )
}
WriteFile
(
hFile
,
mh2
,
mh2
->
mtSize
*
2
,
&
w
,
NULL
);
CloseHandle
(
hFile
);
mh2
=
MF_CreateMetaHeaderDisk
(
mh2
,
lpFilename
,
TRUE
);
}
return
MF_Create_HMETAFILE
(
mh2
);
...
...
dlls/gdi/tests/metafile.c
View file @
2e8bf70f
...
...
@@ -357,14 +357,53 @@ static int compare_mf_bits (const HMETAFILE mf, const unsigned char *bits, UINT
return
diff
;
}
static
int
compare_mf_disk_bits
(
LPCSTR
name
,
const
BYTE
*
bits
,
UINT
bsize
,
const
char
*
desc
)
{
unsigned
char
buf
[
MF_BUFSIZE
];
DWORD
mfsize
,
rd_size
,
i
;
int
diff
;
HANDLE
hfile
;
BOOL
ret
;
hfile
=
CreateFileA
(
name
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
assert
(
hfile
!=
INVALID_HANDLE_VALUE
);
mfsize
=
GetFileSize
(
hfile
,
NULL
);
assert
(
mfsize
<=
MF_BUFSIZE
);
ret
=
ReadFile
(
hfile
,
buf
,
sizeof
(
buf
),
&
rd_size
,
NULL
);
ok
(
ret
&&
rd_size
==
mfsize
,
"ReadFile: error %ld
\n
"
,
GetLastError
());
CloseHandle
(
hfile
);
ok
(
mfsize
==
bsize
,
"%s: mfsize=%ld, bsize=%d.
\n
"
,
desc
,
mfsize
,
bsize
);
if
(
mfsize
!=
bsize
)
return
-
1
;
diff
=
0
;
for
(
i
=
0
;
i
<
bsize
;
i
++
)
{
if
(
buf
[
i
]
!=
bits
[
i
])
diff
++
;
}
ok
(
diff
==
0
,
"%s: mfsize=%ld, bsize=%d, diff=%d
\n
"
,
desc
,
mfsize
,
bsize
,
diff
);
return
diff
;
}
/* Test a blank metafile. May be used as a template for new tests. */
static
void
test_mf_Blank
(
void
)
{
HDC
hdcMetafile
;
HMETAFILE
hMetafile
;
HMETAFILE
hMetafile
,
hmf_copy
;
INT
caps
;
BOOL
ret
;
char
temp_path
[
MAX_PATH
];
char
mf_name
[
MAX_PATH
];
INT
type
;
hdcMetafile
=
CreateMetaFileA
(
NULL
);
ok
(
hdcMetafile
!=
0
,
"CreateMetaFileA(NULL) error %ld
\n
"
,
GetLastError
());
...
...
@@ -377,14 +416,32 @@ static void test_mf_Blank(void)
hMetafile
=
CloseMetaFile
(
hdcMetafile
);
ok
(
hMetafile
!=
0
,
"CloseMetaFile error %ld
\n
"
,
GetLastError
());
type
=
GetObjectType
(
hMetafile
);
ok
(
type
==
OBJ_METAFILE
,
"CloseMetaFile created object with type %d
\n
"
,
type
);
ok
(
!
GetObjectType
(
hdcMetafile
),
"CloseMetaFile has to destroy metafile hdc
\n
"
);
if
(
compare_mf_bits
(
hMetafile
,
MF_BLANK_BITS
,
sizeof
(
MF_BLANK_BITS
),
"mf_blank"
)
!=
0
)
dump_mf_bits
(
hMetafile
,
"mf_Blank"
);
GetTempPathA
(
MAX_PATH
,
temp_path
);
GetTempFileNameA
(
temp_path
,
"wmf"
,
0
,
mf_name
);
hmf_copy
=
CopyMetaFileA
(
hMetafile
,
mf_name
);
ok
(
hmf_copy
!=
0
,
"CopyMetaFile error %ld
\n
"
,
GetLastError
());
type
=
GetObjectType
(
hmf_copy
);
ok
(
type
==
OBJ_METAFILE
,
"CopyMetaFile created object with type %d
\n
"
,
type
);
ret
=
DeleteMetaFile
(
hMetafile
);
ok
(
ret
,
"DeleteMetaFile(%p) error %ld
\n
"
,
hMetafile
,
GetLastError
());
if
(
compare_mf_disk_bits
(
mf_name
,
MF_BLANK_BITS
,
sizeof
(
MF_BLANK_BITS
),
"mf_blank"
)
!=
0
)
dump_mf_bits
(
hmf_copy
,
"mf_Blank"
);
ret
=
DeleteMetaFile
(
hmf_copy
);
ok
(
ret
,
"DeleteMetaFile(%p) error %ld
\n
"
,
hmf_copy
,
GetLastError
());
DeleteFileA
(
mf_name
);
}
/* Simple APIs from mfdrv/graphics.c
...
...
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