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
acec891a
Commit
acec891a
authored
Jun 21, 2008
by
Alex Villacís Lasso
Committed by
Alexandre Julliard
Jun 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: EM_POSFROMCHAR should take into account scrollbar position. With tests.
parent
3cc6e236
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
4 deletions
+119
-4
editor.c
dlls/riched20/editor.c
+9
-0
editor.c
dlls/riched20/tests/editor.c
+53
-2
editor.c
dlls/riched32/tests/editor.c
+57
-2
No files found.
dlls/riched20/editor.c
View file @
acec891a
...
...
@@ -2899,6 +2899,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
ME_DisplayItem
*
pRun
;
int
nCharOfs
,
nOffset
,
nLength
;
POINTL
pt
=
{
0
,
0
};
SCROLLINFO
si
;
nCharOfs
=
wParam
;
/* detect which API version we're dealing with */
...
...
@@ -2917,6 +2918,14 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
pt
.
y
=
editor
->
pBuffer
->
pLast
->
member
.
para
.
nYPos
;
}
pt
.
x
+=
editor
->
selofs
;
si
.
cbSize
=
sizeof
(
si
);
si
.
fMask
=
SIF_POS
;
if
(
GetScrollInfo
(
editor
->
hWnd
,
SB_VERT
,
&
si
))
pt
.
y
-=
si
.
nPos
;
si
.
cbSize
=
sizeof
(
si
);
si
.
fMask
=
SIF_POS
;
if
(
GetScrollInfo
(
editor
->
hWnd
,
SB_HORZ
,
&
si
))
pt
.
x
-=
si
.
nPos
;
if
(
wParam
>=
0x40000
)
{
*
(
POINTL
*
)
wParam
=
pt
;
}
...
...
dlls/riched20/tests/editor.c
View file @
acec891a
...
...
@@ -400,10 +400,19 @@ static void test_EM_SCROLLCARET(void)
static
void
test_EM_POSFROMCHAR
(
void
)
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
unsigned
int
i
;
int
i
;
LRESULT
result
;
unsigned
int
height
=
0
;
unsigned
int
xpos
=
0
;
int
xpos
=
0
;
static
const
char
text
[]
=
"aa
\n
"
"this is a long line of text that should be longer than the "
"control's width
\n
"
"cc
\n
"
"dd
\n
"
"ee
\n
"
"ff
\n
"
"gg
\n
"
"hh
\n
"
;
/* Fill the control to lines to ensure that most of them are offscreen */
for
(
i
=
0
;
i
<
50
;
i
++
)
...
...
@@ -460,6 +469,48 @@ static void test_EM_POSFROMCHAR(void)
ok
(
HIWORD
(
result
)
==
50
*
height
,
"EM_POSFROMCHAR reports y=%d, expected %d
\n
"
,
HIWORD
(
result
),
50
*
height
);
ok
(
LOWORD
(
result
)
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
LOWORD
(
result
));
/* Testing that vertical scrolling does, in fact, have an effect on EM_POSFROMCHAR */
SendMessage
(
hwndRichEdit
,
EM_SCROLL
,
SB_LINEDOWN
,
0
);
/* line down */
for
(
i
=
0
;
i
<
50
;
i
++
)
{
/* All the lines are 16 characters long */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
i
*
16
,
0
);
ok
((
signed
short
)(
HIWORD
(
result
))
==
(
i
-
1
)
*
height
,
"EM_POSFROMCHAR reports y=%hd, expected %d
\n
"
,
(
signed
short
)(
HIWORD
(
result
)),
(
i
-
1
)
*
height
);
ok
(
LOWORD
(
result
)
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
LOWORD
(
result
));
}
/* Testing position at end of text */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
50
*
16
,
0
);
ok
(
HIWORD
(
result
)
==
(
50
-
1
)
*
height
,
"EM_POSFROMCHAR reports y=%d, expected %d
\n
"
,
HIWORD
(
result
),
(
50
-
1
)
*
height
);
ok
(
LOWORD
(
result
)
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
LOWORD
(
result
));
/* Testing position way past end of text */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
55
*
16
,
0
);
ok
(
HIWORD
(
result
)
==
(
50
-
1
)
*
height
,
"EM_POSFROMCHAR reports y=%d, expected %d
\n
"
,
HIWORD
(
result
),
(
50
-
1
)
*
height
);
ok
(
LOWORD
(
result
)
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
LOWORD
(
result
));
/* Testing that horizontal scrolling does, in fact, have an effect on EM_POSFROMCHAR */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
text
);
SendMessage
(
hwndRichEdit
,
EM_SCROLL
,
SB_LINEUP
,
0
);
/* line up */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
0
,
0
);
ok
(
HIWORD
(
result
)
==
0
,
"EM_POSFROMCHAR reports y=%d, expected 0
\n
"
,
HIWORD
(
result
));
todo_wine
{
ok
(
LOWORD
(
result
)
==
1
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
LOWORD
(
result
));
}
xpos
=
LOWORD
(
result
);
SendMessage
(
hwndRichEdit
,
WM_HSCROLL
,
SB_LINERIGHT
,
0
);
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
0
,
0
);
ok
(
HIWORD
(
result
)
==
0
,
"EM_POSFROMCHAR reports y=%d, expected 0
\n
"
,
HIWORD
(
result
));
todo_wine
{
/* Fails on builtin because horizontal scrollbar is not being shown */
ok
((
signed
short
)(
LOWORD
(
result
))
<
xpos
,
"EM_POSFROMCHAR reports x=%hd, expected value less than %d
\n
"
,
(
signed
short
)(
LOWORD
(
result
)),
xpos
);
}
DestroyWindow
(
hwndRichEdit
);
}
...
...
dlls/riched32/tests/editor.c
View file @
acec891a
...
...
@@ -699,11 +699,20 @@ static void test_EM_FINDTEXT(void)
static
void
test_EM_POSFROMCHAR
(
void
)
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
unsigned
int
i
;
int
i
;
POINTL
pl
;
LRESULT
result
;
unsigned
int
height
=
0
;
unsigned
int
xpos
=
0
;
int
xpos
=
0
;
static
const
char
text
[]
=
"aa
\n
"
"this is a long line of text that should be longer than the "
"control's width
\n
"
"cc
\n
"
"dd
\n
"
"ee
\n
"
"ff
\n
"
"gg
\n
"
"hh
\n
"
;
/* Fill the control to lines to ensure that most of them are offscreen */
for
(
i
=
0
;
i
<
50
;
i
++
)
...
...
@@ -763,6 +772,52 @@ static void test_EM_POSFROMCHAR(void)
ok
(
pl
.
y
==
50
*
height
,
"EM_POSFROMCHAR reports y=%d, expected %d
\n
"
,
pl
.
y
,
50
*
height
);
ok
(
pl
.
x
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
pl
.
x
);
/* Testing that vertical scrolling does, in fact, have an effect on EM_POSFROMCHAR */
SendMessage
(
hwndRichEdit
,
EM_SCROLL
,
SB_LINEDOWN
,
0
);
/* line down */
for
(
i
=
0
;
i
<
50
;
i
++
)
{
/* All the lines are 16 characters long */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
(
WPARAM
)
&
pl
,
i
*
16
);
ok
(
result
==
0
,
"EM_POSFROMCHAR returned %ld, expected 0
\n
"
,
result
);
ok
(
pl
.
y
==
(
i
-
1
)
*
height
,
"EM_POSFROMCHAR reports y=%d, expected %d
\n
"
,
pl
.
y
,
(
i
-
1
)
*
height
);
ok
(
pl
.
x
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
pl
.
x
);
}
/* Testing position at end of text */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
(
WPARAM
)
&
pl
,
50
*
16
);
ok
(
result
==
0
,
"EM_POSFROMCHAR returned %ld, expected 0
\n
"
,
result
);
ok
(
pl
.
y
==
(
50
-
1
)
*
height
,
"EM_POSFROMCHAR reports y=%d, expected %d
\n
"
,
pl
.
y
,
(
50
-
1
)
*
height
);
ok
(
pl
.
x
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
pl
.
x
);
/* Testing position way past end of text */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
(
WPARAM
)
&
pl
,
55
*
16
);
ok
(
result
==
0
,
"EM_POSFROMCHAR returned %ld, expected 0
\n
"
,
result
);
ok
(
pl
.
y
==
(
50
-
1
)
*
height
,
"EM_POSFROMCHAR reports y=%d, expected %d
\n
"
,
pl
.
y
,
(
50
-
1
)
*
height
);
ok
(
pl
.
x
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
pl
.
x
);
/* Testing that horizontal scrolling does, in fact, have an effect on EM_POSFROMCHAR */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
text
);
SendMessage
(
hwndRichEdit
,
EM_SCROLL
,
SB_LINEUP
,
0
);
/* line up */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
(
WPARAM
)
&
pl
,
0
);
ok
(
result
==
0
,
"EM_POSFROMCHAR returned %ld, expected 0
\n
"
,
result
);
ok
(
pl
.
y
==
0
,
"EM_POSFROMCHAR reports y=%d, expected 0
\n
"
,
pl
.
y
);
todo_wine
{
ok
(
pl
.
x
==
1
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
pl
.
x
);
}
xpos
=
pl
.
x
;
SendMessage
(
hwndRichEdit
,
WM_HSCROLL
,
SB_LINERIGHT
,
0
);
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
(
WPARAM
)
&
pl
,
0
);
ok
(
result
==
0
,
"EM_POSFROMCHAR returned %ld, expected 0
\n
"
,
result
);
ok
(
pl
.
y
==
0
,
"EM_POSFROMCHAR reports y=%d, expected 0
\n
"
,
pl
.
y
);
todo_wine
{
/* Fails on builtin because horizontal scrollbar is not being shown */
ok
(
pl
.
x
<
xpos
,
"EM_POSFROMCHAR reports x=%hd, expected value less than %d
\n
"
,
pl
.
x
,
xpos
);
}
DestroyWindow
(
hwndRichEdit
);
}
...
...
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