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
2f76829c
Commit
2f76829c
authored
Aug 28, 2013
by
Huw Davies
Committed by
Alexandre Julliard
Aug 28, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32/tests: Split write_ttf_file() into a resource loader and tmp file writer.
parent
b0cf3214
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
42 deletions
+46
-42
font.c
dlls/gdi32/tests/font.c
+46
-42
No files found.
dlls/gdi32/tests/font.c
View file @
2f76829c
...
...
@@ -118,6 +118,52 @@ static BOOL is_font_installed(const char *name)
return
ret
;
}
static
void
*
get_res_data
(
const
char
*
fontname
,
DWORD
*
rsrc_size
)
{
HRSRC
rsrc
;
void
*
rsrc_data
;
rsrc
=
FindResource
(
GetModuleHandle
(
0
),
fontname
,
RT_RCDATA
);
if
(
!
rsrc
)
return
NULL
;
rsrc_data
=
LockResource
(
LoadResource
(
GetModuleHandle
(
0
),
rsrc
));
if
(
!
rsrc_data
)
return
NULL
;
*
rsrc_size
=
SizeofResource
(
GetModuleHandle
(
0
),
rsrc
);
if
(
!*
rsrc_size
)
return
NULL
;
return
rsrc_data
;
}
static
BOOL
write_tmp_file
(
const
void
*
data
,
DWORD
*
size
,
char
*
tmp_name
)
{
char
tmp_path
[
MAX_PATH
];
HANDLE
hfile
;
BOOL
ret
;
GetTempPath
(
MAX_PATH
,
tmp_path
);
GetTempFileName
(
tmp_path
,
"ttf"
,
0
,
tmp_name
);
hfile
=
CreateFile
(
tmp_name
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
0
);
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
ret
=
WriteFile
(
hfile
,
data
,
*
size
,
size
,
NULL
);
CloseHandle
(
hfile
);
return
ret
;
}
static
BOOL
write_ttf_file
(
const
char
*
fontname
,
char
*
tmp_name
)
{
void
*
rsrc_data
;
DWORD
rsrc_size
;
rsrc_data
=
get_res_data
(
fontname
,
&
rsrc_size
);
if
(
!
rsrc_data
)
return
FALSE
;
return
write_tmp_file
(
rsrc_data
,
&
rsrc_size
,
tmp_name
);
}
static
void
check_font
(
const
char
*
test
,
const
LOGFONTA
*
lf
,
HFONT
hfont
)
{
LOGFONTA
getobj_lf
;
...
...
@@ -4499,48 +4545,6 @@ static void test_fullname2(void)
}
static
BOOL
write_ttf_file
(
const
char
*
fontname
,
char
*
tmp_name
)
{
char
tmp_path
[
MAX_PATH
];
HRSRC
rsrc
;
void
*
rsrc_data
;
DWORD
rsrc_size
;
HANDLE
hfile
;
BOOL
ret
;
SetLastError
(
0xdeadbeef
);
rsrc
=
FindResource
(
GetModuleHandle
(
0
),
fontname
,
RT_RCDATA
);
ok
(
rsrc
!=
0
,
"FindResource error %d
\n
"
,
GetLastError
());
if
(
!
rsrc
)
return
FALSE
;
SetLastError
(
0xdeadbeef
);
rsrc_data
=
LockResource
(
LoadResource
(
GetModuleHandle
(
0
),
rsrc
));
ok
(
rsrc_data
!=
0
,
"LockResource error %d
\n
"
,
GetLastError
());
if
(
!
rsrc_data
)
return
FALSE
;
SetLastError
(
0xdeadbeef
);
rsrc_size
=
SizeofResource
(
GetModuleHandle
(
0
),
rsrc
);
ok
(
rsrc_size
!=
0
,
"SizeofResource error %d
\n
"
,
GetLastError
());
if
(
!
rsrc_size
)
return
FALSE
;
SetLastError
(
0xdeadbeef
);
ret
=
GetTempPath
(
MAX_PATH
,
tmp_path
);
ok
(
ret
,
"GetTempPath() error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetTempFileName
(
tmp_path
,
"ttf"
,
0
,
tmp_name
);
ok
(
ret
,
"GetTempFileName() error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
hfile
=
CreateFile
(
tmp_name
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
0
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"CreateFile() error %d
\n
"
,
GetLastError
());
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
SetLastError
(
0xdeadbeef
);
ret
=
WriteFile
(
hfile
,
rsrc_data
,
rsrc_size
,
&
rsrc_size
,
NULL
);
ok
(
ret
,
"WriteFile() error %d
\n
"
,
GetLastError
());
CloseHandle
(
hfile
);
return
ret
;
}
static
void
test_GetGlyphOutline_empty_contour
(
void
)
{
HDC
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