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
9bb54156
Commit
9bb54156
authored
Apr 12, 2016
by
Huw Davies
Committed by
Alexandre Julliard
Apr 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32/tests: Fix the size test in the case of an underflow of Lo.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fcb9ff95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
38 deletions
+36
-38
olefont.c
dlls/oleaut32/tests/olefont.c
+36
-38
No files found.
dlls/oleaut32/tests/olefont.c
View file @
9bb54156
...
@@ -58,9 +58,8 @@ static HRESULT (WINAPI *pOleCreateFontIndirect)(LPFONTDESC,REFIID,LPVOID*);
...
@@ -58,9 +58,8 @@ static HRESULT (WINAPI *pOleCreateFontIndirect)(LPFONTDESC,REFIID,LPVOID*);
/* SetRatio to ratio_logical, ratio_himetric, */
/* SetRatio to ratio_logical, ratio_himetric, */
/* check that resulting hfont has height hfont_height. */
/* check that resulting hfont has height hfont_height. */
/* Various checks along the way. */
/* Various checks along the way. */
static
void
test_ifont_size
(
LONG
lo_size
,
LONG
hi_size
,
static
void
test_ifont_size
(
LONGLONG
size
,
LONG
ratio_logical
,
LONG
ratio_himetric
,
LONG
ratio_logical
,
LONG
ratio_himetric
,
LONG
hfont_height
,
const
char
*
test_name
)
LONG
hfont_height
,
const
char
*
test_name
)
{
{
FONTDESC
fd
;
FONTDESC
fd
;
LPVOID
pvObj
=
NULL
;
LPVOID
pvObj
=
NULL
;
...
@@ -73,8 +72,7 @@ static void test_ifont_size(LONG lo_size, LONG hi_size,
...
@@ -73,8 +72,7 @@ static void test_ifont_size(LONG lo_size, LONG hi_size,
fd
.
cbSizeofstruct
=
sizeof
(
FONTDESC
);
fd
.
cbSizeofstruct
=
sizeof
(
FONTDESC
);
fd
.
lpstrName
=
arial_font
;
/* using scalable instead of bitmap font reduces errors due to font realization */
fd
.
lpstrName
=
arial_font
;
/* using scalable instead of bitmap font reduces errors due to font realization */
S
(
fd
.
cySize
).
Lo
=
lo_size
;
fd
.
cySize
.
int64
=
size
;
S
(
fd
.
cySize
).
Hi
=
hi_size
;
fd
.
sWeight
=
0
;
fd
.
sWeight
=
0
;
fd
.
sCharset
=
0
;
fd
.
sCharset
=
0
;
fd
.
fItalic
=
FALSE
;
fd
.
fItalic
=
FALSE
;
...
@@ -99,9 +97,9 @@ static void test_ifont_size(LONG lo_size, LONG hi_size,
...
@@ -99,9 +97,9 @@ static void test_ifont_size(LONG lo_size, LONG hi_size,
test_name
,
hres
);
test_name
,
hres
);
/* Check returned size - allow for errors due to rounding & font realization. */
/* Check returned size - allow for errors due to rounding & font realization. */
ok
((
abs
(
S
(
psize
).
Lo
-
lo_size
)
<
10000
)
&&
S
(
psize
).
Hi
==
hi_size
,
ok
((
psize
.
int64
-
size
)
<
10000
&&
(
psize
.
int64
-
size
)
>
-
10000
,
"%s: IFont_get_Size: Lo=%d, Hi=%d; expected Lo=%d, Hi=%d.
\n
"
,
"%s: IFont_get_Size: Lo=%d, Hi=%d; expected Lo=%d, Hi=%d.
\n
"
,
test_name
,
S
(
psize
).
Lo
,
S
(
psize
).
Hi
,
lo_size
,
hi_size
);
test_name
,
S
(
psize
).
Lo
,
S
(
psize
).
Hi
,
fd
.
cySize
.
Lo
,
fd
.
cySize
.
Hi
);
/* Check hFont size. */
/* Check hFont size. */
hres
=
IFont_get_hFont
(
ifnt
,
&
hfont
);
hres
=
IFont_get_hFont
(
ifnt
,
&
hfont
);
...
@@ -130,59 +128,59 @@ static void test_ifont_sizes(void)
...
@@ -130,59 +128,59 @@ static void test_ifont_sizes(void)
ReleaseDC
(
0
,
hdc
);
ReleaseDC
(
0
,
hdc
);
if
(
dpi
==
96
)
/* normal resolution display */
if
(
dpi
==
96
)
/* normal resolution display */
{
{
test_ifont_size
(
180000
,
0
,
0
,
0
,
-
24
,
"default"
);
/* normal font */
test_ifont_size
(
180000
,
0
,
0
,
-
24
,
"default"
);
/* normal font */
test_ifont_size
(
186000
,
0
,
0
,
0
,
-
25
,
"rounding"
);
/* test rounding */
test_ifont_size
(
186000
,
0
,
0
,
-
25
,
"rounding"
);
/* test rounding */
}
else
if
(
dpi
==
72
)
/* low resolution display */
}
else
if
(
dpi
==
72
)
/* low resolution display */
{
{
test_ifont_size
(
180000
,
0
,
0
,
0
,
-
18
,
"default"
);
/* normal font */
test_ifont_size
(
180000
,
0
,
0
,
-
18
,
"default"
);
/* normal font */
test_ifont_size
(
186000
,
0
,
0
,
0
,
-
19
,
"rounding"
);
/* test rounding */
test_ifont_size
(
186000
,
0
,
0
,
-
19
,
"rounding"
);
/* test rounding */
}
else
if
(
dpi
==
120
)
/* high resolution display */
}
else
if
(
dpi
==
120
)
/* high resolution display */
{
{
test_ifont_size
(
180000
,
0
,
0
,
0
,
-
30
,
"default"
);
/* normal font */
test_ifont_size
(
180000
,
0
,
0
,
-
30
,
"default"
);
/* normal font */
test_ifont_size
(
186000
,
0
,
0
,
0
,
-
31
,
"rounding"
);
/* test rounding */
test_ifont_size
(
186000
,
0
,
0
,
-
31
,
"rounding"
);
/* test rounding */
}
else
}
else
skip
(
"Skipping resolution dependent font size tests - display resolution is %d
\n
"
,
dpi
);
skip
(
"Skipping resolution dependent font size tests - display resolution is %d
\n
"
,
dpi
);
/* Next 4 tests specify a scaling ratio, so display resolution is not a factor. */
/* Next 4 tests specify a scaling ratio, so display resolution is not a factor. */
test_ifont_size
(
180000
,
0
,
72
,
2540
,
-
18
,
"ratio1"
);
/* change ratio */
test_ifont_size
(
180000
,
72
,
2540
,
-
18
,
"ratio1"
);
/* change ratio */
test_ifont_size
(
180000
,
0
,
144
,
2540
,
-
36
,
"ratio2"
);
/* another ratio */
test_ifont_size
(
180000
,
144
,
2540
,
-
36
,
"ratio2"
);
/* another ratio */
test_ifont_size
(
180000
,
0
,
72
,
1270
,
-
36
,
"ratio3"
);
/* yet another ratio */
test_ifont_size
(
180000
,
72
,
1270
,
-
36
,
"ratio3"
);
/* yet another ratio */
test_ifont_size
(
186000
,
0
,
72
,
2540
,
-
19
,
"rounding+ratio"
);
/* test rounding with ratio */
test_ifont_size
(
186000
,
72
,
2540
,
-
19
,
"rounding+ratio"
);
/* test rounding with ratio */
/* test various combinations of logical == himetric */
/* test various combinations of logical == himetric */
test_ifont_size
(
180000
,
0
,
10
,
10
,
-
635
,
"identical ratio 1"
);
test_ifont_size
(
180000
,
10
,
10
,
-
635
,
"identical ratio 1"
);
test_ifont_size
(
240000
,
0
,
10
,
10
,
-
848
,
"identical ratio 2"
);
test_ifont_size
(
240000
,
10
,
10
,
-
848
,
"identical ratio 2"
);
test_ifont_size
(
300000
,
0
,
10
,
10
,
-
1058
,
"identical ratio 3"
);
test_ifont_size
(
300000
,
10
,
10
,
-
1058
,
"identical ratio 3"
);
/* test various combinations of logical and himetric both set to 1 */
/* test various combinations of logical and himetric both set to 1 */
test_ifont_size
(
180000
,
0
,
1
,
1
,
-
24
,
"1:1 ratio 1"
);
test_ifont_size
(
180000
,
1
,
1
,
-
24
,
"1:1 ratio 1"
);
test_ifont_size
(
240000
,
0
,
1
,
1
,
-
32
,
"1:1 ratio 2"
);
test_ifont_size
(
240000
,
1
,
1
,
-
32
,
"1:1 ratio 2"
);
test_ifont_size
(
300000
,
0
,
1
,
1
,
-
40
,
"1:1 ratio 3"
);
test_ifont_size
(
300000
,
1
,
1
,
-
40
,
"1:1 ratio 3"
);
/* test various combinations of logical set to 1 */
/* test various combinations of logical set to 1 */
test_ifont_size
(
180000
,
0
,
1
,
0
,
-
24
,
"1:0 ratio 1"
);
test_ifont_size
(
180000
,
1
,
0
,
-
24
,
"1:0 ratio 1"
);
test_ifont_size
(
240000
,
0
,
1
,
0
,
-
32
,
"1:0 ratio 2"
);
test_ifont_size
(
240000
,
1
,
0
,
-
32
,
"1:0 ratio 2"
);
test_ifont_size
(
300000
,
0
,
1
,
0
,
-
40
,
"1:0 ratio 3"
);
test_ifont_size
(
300000
,
1
,
0
,
-
40
,
"1:0 ratio 3"
);
/* test various combinations of himetric set to 1 */
/* test various combinations of himetric set to 1 */
test_ifont_size
(
180000
,
0
,
0
,
1
,
-
24
,
"0:1 ratio 1"
);
test_ifont_size
(
180000
,
0
,
1
,
-
24
,
"0:1 ratio 1"
);
test_ifont_size
(
240000
,
0
,
0
,
1
,
-
32
,
"0:1 ratio 2"
);
test_ifont_size
(
240000
,
0
,
1
,
-
32
,
"0:1 ratio 2"
);
test_ifont_size
(
300000
,
0
,
0
,
1
,
-
40
,
"0:1 ratio 3"
);
test_ifont_size
(
300000
,
0
,
1
,
-
40
,
"0:1 ratio 3"
);
/* test various combinations of 2:1 logical:himetric */
/* test various combinations of 2:1 logical:himetric */
test_ifont_size
(
180000
,
0
,
2
,
1
,
-
1270
,
"2:1 ratio 1"
);
test_ifont_size
(
180000
,
2
,
1
,
-
1270
,
"2:1 ratio 1"
);
test_ifont_size
(
240000
,
0
,
2
,
1
,
-
1694
,
"2:1 ratio 2"
);
test_ifont_size
(
240000
,
2
,
1
,
-
1694
,
"2:1 ratio 2"
);
test_ifont_size
(
300000
,
0
,
2
,
1
,
-
2117
,
"2:1 ratio 3"
);
test_ifont_size
(
300000
,
2
,
1
,
-
2117
,
"2:1 ratio 3"
);
/* test various combinations of 1:2 logical:himetric */
/* test various combinations of 1:2 logical:himetric */
test_ifont_size
(
180000
,
0
,
1
,
2
,
-
318
,
"1:2 ratio 1"
);
test_ifont_size
(
180000
,
1
,
2
,
-
318
,
"1:2 ratio 1"
);
test_ifont_size
(
240000
,
0
,
1
,
2
,
-
424
,
"1:2 ratio 2"
);
test_ifont_size
(
240000
,
1
,
2
,
-
424
,
"1:2 ratio 2"
);
test_ifont_size
(
300000
,
0
,
1
,
2
,
-
529
,
"1:2 ratio 3"
);
test_ifont_size
(
300000
,
1
,
2
,
-
529
,
"1:2 ratio 3"
);
/* test various combinations of logical and himetric both set to 2 */
/* test various combinations of logical and himetric both set to 2 */
test_ifont_size
(
180000
,
0
,
2
,
2
,
-
635
,
"2:2 ratio 1"
);
test_ifont_size
(
180000
,
2
,
2
,
-
635
,
"2:2 ratio 1"
);
test_ifont_size
(
240000
,
0
,
2
,
2
,
-
848
,
"2:2 ratio 2"
);
test_ifont_size
(
240000
,
2
,
2
,
-
848
,
"2:2 ratio 2"
);
test_ifont_size
(
300000
,
0
,
2
,
2
,
-
1058
,
"2:2 ratio 3"
);
test_ifont_size
(
300000
,
2
,
2
,
-
1058
,
"2:2 ratio 3"
);
}
}
static
void
test_QueryInterface
(
void
)
static
void
test_QueryInterface
(
void
)
...
...
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