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
c8c29eeb
Commit
c8c29eeb
authored
Apr 18, 2019
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Apr 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Use calculated WM_SETFONT margins in the CJK case.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6b2c2d39
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
8 deletions
+44
-8
edit.c
dlls/user32/tests/edit.c
+44
-8
No files found.
dlls/user32/tests/edit.c
View file @
c8c29eeb
...
...
@@ -1559,6 +1559,28 @@ static INT get_cjk_fontinfo_margin(INT width, INT side_bearing)
return
margin
;
}
static
DWORD
get_cjk_font_margins
(
HDC
hdc
,
BOOL
unicode
)
{
ABC
abc
[
256
];
SHORT
left
,
right
;
UINT
i
;
left
=
right
=
0
;
if
(
unicode
)
{
if
(
!
GetCharABCWidthsW
(
hdc
,
0
,
255
,
abc
))
return
0
;
}
else
{
if
(
!
GetCharABCWidthsA
(
hdc
,
0
,
255
,
abc
))
return
0
;
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
abc
);
i
++
)
{
if
(
-
abc
[
i
].
abcA
>
right
)
right
=
-
abc
[
i
].
abcA
;
if
(
-
abc
[
i
].
abcC
>
left
)
left
=
-
abc
[
i
].
abcC
;
}
return
MAKELONG
(
left
,
right
);
}
static
void
test_margins_default
(
const
char
*
facename
,
UINT
charset
)
{
HWND
hwnd
;
...
...
@@ -1569,7 +1591,7 @@ static void test_margins_default(const char* facename, UINT charset)
LOGFONTA
lf
;
HFONT
hfont
;
RECT
rect
;
INT
margins
,
expect
;
INT
margins
,
expect
,
font_expect
;
const
UINT
small_margins
=
MAKELONG
(
1
,
5
);
const
WCHAR
EditW
[]
=
{
'E'
,
'd'
,
'i'
,
't'
,
0
},
strW
[]
=
{
'W'
,
0
};
struct
char_width_info
{
...
...
@@ -1615,9 +1637,14 @@ static void test_margins_default(const char* facename, UINT charset)
left
=
get_cjk_fontinfo_margin
(
size
.
cx
,
info
.
lsb
);
right
=
get_cjk_fontinfo_margin
(
size
.
cx
,
info
.
rsb
);
expect
=
MAKELONG
(
left
,
right
);
font_expect
=
get_cjk_font_margins
(
hdc
,
TRUE
);
if
(
!
font_expect
)
/* In this case, margins aren't updated */
font_expect
=
small_margins
;
}
else
expect
=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
);
font_expect
=
expect
=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
);
hfont
=
SelectObject
(
hdc
,
hfont
);
ReleaseDC
(
hwnd
,
hdc
);
...
...
@@ -1627,12 +1654,11 @@ static void test_margins_default(const char* facename, 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
,
"%s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
todo_wine_if
(
cjk_charset
)
ok
(
margins
==
font_expect
,
"%s:%d: expected %d, %d, got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
font_expect
),
LOWORD
(
font_expect
)
,
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
);
ok
(
margins
==
expect
,
"%s:%d: expected %d, %d, got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
expect
),
LOWORD
(
expect
),
HIWORD
(
margins
),
LOWORD
(
margins
));
DestroyWindow
(
hwnd
);
...
...
@@ -1642,17 +1668,27 @@ static void test_margins_default(const char* facename, UINT charset)
GetClientRect
(
hwnd
,
&
rect
);
ok
(
!
IsRectEmpty
(
&
rect
),
"got rect %s
\n
"
,
wine_dbgstr_rect
(
&
rect
));
if
(
cjk_charset
)
{
hdc
=
GetDC
(
hwnd
);
hfont
=
SelectObject
(
hdc
,
hfont
);
font_expect
=
get_cjk_font_margins
(
hdc
,
FALSE
);
if
(
!
font_expect
)
/* In this case, margins aren't updated */
font_expect
=
small_margins
;
hfont
=
SelectObject
(
hdc
,
hfont
);
ReleaseDC
(
hwnd
,
hdc
);
}
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
ok
(
margins
==
0
,
"got %x
\n
"
,
margins
);
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
,
"%s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
todo_wine_if
(
cjk_charset
)
ok
(
margins
==
font_expect
,
"%s:%d: expected %d, %d, got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
font_expect
),
LOWORD
(
font_expect
)
,
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
);
ok
(
margins
==
expect
,
"%s:%d: expected %d, %d, got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
expect
),
LOWORD
(
expect
),
HIWORD
(
margins
),
LOWORD
(
margins
));
DestroyWindow
(
hwnd
);
...
...
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