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
28400eff
Commit
28400eff
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: Use calculated EC_USEFONTINFO margins in the CJK case.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
95f7ad03
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
15 deletions
+31
-15
edit.c
dlls/comctl32/tests/edit.c
+31
-15
No files found.
dlls/comctl32/tests/edit.c
View file @
28400eff
...
@@ -1603,6 +1603,16 @@ static void test_margins_usefontinfo(UINT charset)
...
@@ -1603,6 +1603,16 @@ static void test_margins_usefontinfo(UINT charset)
DeleteObject
(
hfont
);
DeleteObject
(
hfont
);
}
}
static
INT
get_cjk_fontinfo_margin
(
INT
width
,
INT
side_bearing
)
{
INT
margin
;
if
(
side_bearing
<
0
)
margin
=
min
(
-
side_bearing
,
width
/
2
);
else
margin
=
0
;
return
margin
;
}
static
void
test_margins_default
(
const
char
*
facename
,
UINT
charset
)
static
void
test_margins_default
(
const
char
*
facename
,
UINT
charset
)
{
{
HWND
hwnd
;
HWND
hwnd
;
...
@@ -1616,6 +1626,14 @@ static void test_margins_default(const char* facename, UINT charset)
...
@@ -1616,6 +1626,14 @@ static void test_margins_default(const char* facename, UINT charset)
INT
margins
,
expect
;
INT
margins
,
expect
;
const
UINT
small_margins
=
MAKELONG
(
1
,
5
);
const
UINT
small_margins
=
MAKELONG
(
1
,
5
);
const
WCHAR
EditW
[]
=
{
'E'
,
'd'
,
'i'
,
't'
,
0
},
strW
[]
=
{
'W'
,
0
};
const
WCHAR
EditW
[]
=
{
'E'
,
'd'
,
'i'
,
't'
,
0
},
strW
[]
=
{
'W'
,
0
};
struct
char_width_info
{
INT
lsb
,
rsb
,
unknown
;
}
info
;
HMODULE
hgdi32
;
BOOL
(
WINAPI
*
pGetCharWidthInfo
)(
HDC
,
struct
char_width_info
*
);
hgdi32
=
GetModuleHandleA
(
"gdi32.dll"
);
pGetCharWidthInfo
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetCharWidthInfo"
);
memset
(
&
lf
,
0
,
sizeof
(
lf
));
memset
(
&
lf
,
0
,
sizeof
(
lf
));
lf
.
lfHeight
=
-
11
;
lf
.
lfHeight
=
-
11
;
...
@@ -1644,8 +1662,16 @@ static void test_margins_default(const char* facename, UINT charset)
...
@@ -1644,8 +1662,16 @@ static void test_margins_default(const char* facename, UINT charset)
DeleteObject
(
hfont
);
DeleteObject
(
hfont
);
return
;
return
;
}
}
expect
=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
);
cjk
=
is_cjk
(
hdc
);
cjk
=
is_cjk
(
hdc
);
if
(
cjk
&&
pGetCharWidthInfo
&&
pGetCharWidthInfo
(
hdc
,
&
info
))
{
short
left
,
right
;
left
=
get_cjk_fontinfo_margin
(
size
.
cx
,
info
.
lsb
);
right
=
get_cjk_fontinfo_margin
(
size
.
cx
,
info
.
rsb
);
expect
=
MAKELONG
(
left
,
right
);
}
else
expect
=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
);
hfont
=
SelectObject
(
hdc
,
hfont
);
hfont
=
SelectObject
(
hdc
,
hfont
);
ReleaseDC
(
hwnd
,
hdc
);
ReleaseDC
(
hwnd
,
hdc
);
...
@@ -1660,13 +1686,8 @@ static void test_margins_default(const char* facename, UINT charset)
...
@@ -1660,13 +1686,8 @@ static void test_margins_default(const char* facename, UINT charset)
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
if
(
!
cjk
)
todo_wine_if
(
cjk
&&
expect
!=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
))
ok
(
margins
==
expect
,
"%s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
ok
(
margins
==
expect
,
"%s:%d: expected %d, %d, got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
expect
),
LOWORD
(
expect
),
HIWORD
(
margins
),
LOWORD
(
margins
));
else
{
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
);
DestroyWindow
(
hwnd
);
/* ANSI version */
/* ANSI version */
...
@@ -1685,13 +1706,8 @@ static void test_margins_default(const char* facename, UINT charset)
...
@@ -1685,13 +1706,8 @@ static void test_margins_default(const char* facename, UINT charset)
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
if
(
!
cjk
)
todo_wine_if
(
cjk
&&
expect
!=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
))
ok
(
margins
==
expect
,
"%s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
ok
(
margins
==
expect
,
"%s:%d: expected %d, %d, got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
expect
),
LOWORD
(
expect
),
HIWORD
(
margins
),
LOWORD
(
margins
));
else
{
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
);
DestroyWindow
(
hwnd
);
DeleteObject
(
hfont
);
DeleteObject
(
hfont
);
...
...
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