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
95f7ad03
Commit
95f7ad03
authored
Apr 24, 2019
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Apr 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tests: Tests default margin size with various font face and charset.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5012c1b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
34 deletions
+66
-34
edit.c
dlls/comctl32/tests/edit.c
+66
-34
No files found.
dlls/comctl32/tests/edit.c
View file @
95f7ad03
...
...
@@ -1485,13 +1485,17 @@ static void test_edit_control_scroll(void)
DestroyWindow
(
hwEdit
);
}
static
BOOL
is_cjk
_charset
(
HDC
dc
)
static
BOOL
is_cjk
(
HDC
dc
)
{
const
DWORD
FS_DBCS_MASK
=
FS_JISJAPAN
|
FS_CHINESESIMP
|
FS_WANSUNG
|
FS_CHINESETRAD
|
FS_JOHAB
;
FONTSIGNATURE
fs
;
switch
(
GdiGetCodePage
(
dc
))
{
case
932
:
case
936
:
case
949
:
case
950
:
case
1361
:
return
TRUE
;
default:
return
FALSE
;
return
(
GetTextCharsetInfo
(
dc
,
&
fs
,
0
)
!=
DEFAULT_CHARSET
&&
(
fs
.
fsCsb
[
0
]
&
FS_DBCS_MASK
));
}
}
...
...
@@ -1599,13 +1603,13 @@ static void test_margins_usefontinfo(UINT charset)
DeleteObject
(
hfont
);
}
static
void
test_margins_default
(
UINT
charset
)
static
void
test_margins_default
(
const
char
*
facename
,
UINT
charset
)
{
HWND
hwnd
;
HDC
hdc
;
TEXTMETRICW
tm
;
SIZE
size
;
BOOL
cjk
_charset
;
BOOL
cjk
;
LOGFONTA
lf
;
HFONT
hfont
;
RECT
rect
;
...
...
@@ -1617,7 +1621,7 @@ static void test_margins_default(UINT charset)
lf
.
lfHeight
=
-
11
;
lf
.
lfWeight
=
FW_NORMAL
;
lf
.
lfCharSet
=
charset
;
strcpy
(
lf
.
lfFaceName
,
"Tahoma"
);
strcpy
(
lf
.
lfFaceName
,
facename
);
hfont
=
CreateFontIndirectA
(
&
lf
);
ok
(
hfont
!=
NULL
,
"got %p
\n
"
,
hfont
);
...
...
@@ -1641,7 +1645,7 @@ static void test_margins_default(UINT charset)
return
;
}
expect
=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
);
cjk
_charset
=
is_cjk_charset
(
hdc
);
cjk
=
is_cjk
(
hdc
);
hfont
=
SelectObject
(
hdc
,
hfont
);
ReleaseDC
(
hwnd
,
hdc
);
...
...
@@ -1651,17 +1655,17 @@ static void test_margins_default(UINT charset)
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
WM_SETFONT
,
(
WPARAM
)
hfont
,
MAKELPARAM
(
TRUE
,
0
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
if
(
!
cjk
_charset
)
ok
(
margins
==
expect
,
"%
d: got %d, %d
\n
"
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
if
(
!
cjk
)
ok
(
margins
==
expect
,
"%
s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
if
(
!
cjk
_charset
)
ok
(
margins
==
expect
,
"%
d: got %d, %d
\n
"
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
if
(
!
cjk
)
ok
(
margins
==
expect
,
"%
s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
else
{
ok
(
HIWORD
(
margins
)
<=
HIWORD
(
expect
),
"%
d: got %d
\n
"
,
charset
,
HIWORD
(
margins
));
ok
(
LOWORD
(
margins
)
<=
LOWORD
(
expect
),
"%
d: got %d
\n
"
,
charset
,
LOWORD
(
margins
));
ok
(
HIWORD
(
margins
)
<=
HIWORD
(
expect
),
"%
s:%d: got %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
));
ok
(
LOWORD
(
margins
)
<=
LOWORD
(
expect
),
"%
s:%d: got %d
\n
"
,
facename
,
charset
,
LOWORD
(
margins
));
}
DestroyWindow
(
hwnd
);
...
...
@@ -1676,23 +1680,40 @@ static void test_margins_default(UINT charset)
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
WM_SETFONT
,
(
WPARAM
)
hfont
,
MAKELPARAM
(
TRUE
,
0
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
if
(
!
cjk
_charset
)
ok
(
margins
==
expect
,
"%
d: got %d, %d
\n
"
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
if
(
!
cjk
)
ok
(
margins
==
expect
,
"%
s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
if
(
!
cjk
_charset
)
ok
(
margins
==
expect
,
"%
d: got %d, %d
\n
"
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
if
(
!
cjk
)
ok
(
margins
==
expect
,
"%
s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
else
{
ok
(
HIWORD
(
margins
)
<=
HIWORD
(
expect
),
"%
d: got %d
\n
"
,
charset
,
HIWORD
(
margins
));
ok
(
LOWORD
(
margins
)
<=
LOWORD
(
expect
),
"%
d: got %d
\n
"
,
charset
,
LOWORD
(
margins
));
ok
(
HIWORD
(
margins
)
<=
HIWORD
(
expect
),
"%
s:%d: got %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
));
ok
(
LOWORD
(
margins
)
<=
LOWORD
(
expect
),
"%
s:%d: got %d
\n
"
,
facename
,
charset
,
LOWORD
(
margins
));
}
DestroyWindow
(
hwnd
);
DeleteObject
(
hfont
);
}
static
INT
CALLBACK
find_font_proc
(
const
LOGFONTA
*
elf
,
const
TEXTMETRICA
*
ntm
,
DWORD
type
,
LPARAM
lParam
)
{
return
0
;
}
static
BOOL
is_font_installed
(
const
char
*
name
)
{
HDC
hdc
=
GetDC
(
NULL
);
BOOL
ret
=
FALSE
;
if
(
!
EnumFontFamiliesA
(
hdc
,
name
,
find_font_proc
,
0
))
ret
=
TRUE
;
ReleaseDC
(
NULL
,
hdc
);
return
ret
;
}
static
void
test_margins
(
void
)
{
DWORD
old_margins
,
new_margins
;
...
...
@@ -1768,33 +1789,44 @@ static void test_margins(void)
test_margins_usefontinfo
(
DEFAULT_CHARSET
);
test_margins_default
(
ANSI_CHARSET
);
test_margins_default
(
EASTEUROPE_CHARSET
);
test_margins_default
(
"Tahoma"
,
ANSI_CHARSET
);
test_margins_default
(
"Tahoma"
,
EASTEUROPE_CHARSET
);
test_margins_default
(
SHIFTJIS_CHARSET
);
test_margins_default
(
HANGUL_CHARSET
);
test_margins_default
(
CHINESEBIG5_CHARSET
);
}
test_margins_default
(
"Tahoma"
,
HANGUL_CHARSET
);
test_margins_default
(
"Tahoma"
,
CHINESEBIG5_CHARSET
);
static
INT
CALLBACK
find_font_proc
(
const
LOGFONTA
*
elf
,
const
TEXTMETRICA
*
ntm
,
DWORD
type
,
LPARAM
lParam
)
{
return
0
;
if
(
is_font_installed
(
"MS PGothic"
))
{
test_margins_default
(
"MS PGothic"
,
SHIFTJIS_CHARSET
);
test_margins_default
(
"MS PGothic"
,
GREEK_CHARSET
);
}
else
skip
(
"MS PGothic is not available, skipping some margin tests
\n
"
);
if
(
is_font_installed
(
"Ume P Gothic"
))
{
test_margins_default
(
"Ume P Gothic"
,
SHIFTJIS_CHARSET
);
test_margins_default
(
"Ume P Gothic"
,
GREEK_CHARSET
);
}
else
skip
(
"Ume P Gothic is not available, skipping some margin tests
\n
"
);
if
(
is_font_installed
(
"SimSun"
))
{
test_margins_default
(
"SimSun"
,
GB2312_CHARSET
);
test_margins_default
(
"SimSun"
,
ANSI_CHARSET
);
}
else
skip
(
"SimSun is not available, skipping some margin tests
\n
"
);
}
static
void
test_margins_font_change
(
void
)
{
DWORD
margins
,
font_margins
,
ret
;
DWORD
margins
,
font_margins
;
HFONT
hfont
,
hfont2
;
HWND
hwEdit
;
LOGFONTA
lf
;
HDC
hdc
;
hdc
=
GetDC
(
0
);
ret
=
EnumFontFamiliesA
(
hdc
,
"Arial"
,
find_font_proc
,
0
);
ReleaseDC
(
0
,
hdc
);
if
(
ret
)
if
(
!
is_font_installed
(
"Arial"
))
{
trace
(
"Arial not found - skipping font change margin tests
\n
"
);
skip
(
"Arial not found - skipping font change margin tests
\n
"
);
return
;
}
...
...
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