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
3cc6e236
Commit
3cc6e236
authored
Jun 23, 2008
by
Alex Villacís Lasso
Committed by
Alexandre Julliard
Jun 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: When returning position through wParam pointer, EM_POSFROMCHAR must return 0 as LRESULT.
Add tests for EM_POSFROMCHAR for 1.0 and 2.0.
parent
15a5da97
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
1 deletion
+141
-1
editor.c
dlls/riched20/editor.c
+1
-1
editor.c
dlls/riched20/tests/editor.c
+67
-0
wrap.c
dlls/riched20/wrap.c
+3
-0
editor.c
dlls/riched32/tests/editor.c
+70
-0
No files found.
dlls/riched20/editor.c
View file @
3cc6e236
...
...
@@ -2920,7 +2920,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
if
(
wParam
>=
0x40000
)
{
*
(
POINTL
*
)
wParam
=
pt
;
}
return
MAKELONG
(
pt
.
x
,
pt
.
y
);
return
(
wParam
>=
0x40000
)
?
0
:
MAKELONG
(
pt
.
x
,
pt
.
y
);
}
case
WM_CREATE
:
if
(
GetWindowLongW
(
hWnd
,
GWL_STYLE
)
&
WS_HSCROLL
)
...
...
dlls/riched20/tests/editor.c
View file @
3cc6e236
...
...
@@ -397,6 +397,72 @@ static void test_EM_SCROLLCARET(void)
DestroyWindow
(
hwndRichEdit
);
}
static
void
test_EM_POSFROMCHAR
(
void
)
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
unsigned
int
i
;
LRESULT
result
;
unsigned
int
height
=
0
;
unsigned
int
xpos
=
0
;
/* Fill the control to lines to ensure that most of them are offscreen */
for
(
i
=
0
;
i
<
50
;
i
++
)
{
/* Do not modify the string; it is exactly 16 characters long. */
SendMessage
(
hwndRichEdit
,
EM_SETSEL
,
0
,
0
);
SendMessage
(
hwndRichEdit
,
EM_REPLACESEL
,
0
,
(
LPARAM
)
"0123456789ABCDE
\n
"
);
}
/*
Richedit 1.0 receives a POINTL* on wParam and character offset on lParam, returns void.
Richedit 2.0 receives character offset on wParam, ignores lParam, returns MAKELONG(x,y)
Richedit 3.0 accepts either of the above API conventions.
*/
/* Testing Richedit 2.0 API format */
/* Testing start of lines. X-offset should be constant on all cases (native is 1).
Since all lines are identical and drawn with the same font,
they should have the same height... right?
*/
for
(
i
=
0
;
i
<
50
;
i
++
)
{
/* All the lines are 16 characters long */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
i
*
16
,
0
);
if
(
i
==
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
);
}
else
if
(
i
==
1
)
{
ok
(
HIWORD
(
result
)
>
0
,
"EM_POSFROMCHAR reports y=%d, expected > 0
\n
"
,
HIWORD
(
result
));
ok
(
LOWORD
(
result
)
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
LOWORD
(
result
));
height
=
HIWORD
(
result
);
}
else
{
ok
(
HIWORD
(
result
)
==
i
*
height
,
"EM_POSFROMCHAR reports y=%d, expected %d
\n
"
,
HIWORD
(
result
),
i
*
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
*
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 position way past end of text */
result
=
SendMessage
(
hwndRichEdit
,
EM_POSFROMCHAR
,
55
*
16
,
0
);
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
));
DestroyWindow
(
hwndRichEdit
);
}
static
void
test_EM_SETCHARFORMAT
(
void
)
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
...
...
@@ -4170,6 +4236,7 @@ START_TEST( editor )
test_WM_CHAR
();
test_EM_FINDTEXT
();
test_EM_GETLINE
();
test_EM_POSFROMCHAR
();
test_EM_SCROLLCARET
();
test_EM_SCROLL
();
test_WM_SETTEXT
();
...
...
dlls/riched20/wrap.c
View file @
3cc6e236
...
...
@@ -471,6 +471,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) {
ME_Context
c
;
BOOL
bModified
=
FALSE
;
int
yStart
=
-
1
;
int
yLastPos
=
0
;
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
));
editor
->
nHeight
=
0
;
...
...
@@ -496,6 +497,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) {
bModified
=
bModified
|
bRedraw
;
yLastPos
=
c
.
pt
.
y
;
c
.
pt
.
y
+=
item
->
member
.
para
.
nHeight
;
item
=
item
->
member
.
para
.
next_para
;
}
...
...
@@ -503,6 +505,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) {
editor
->
sizeWindow
.
cy
=
c
.
rcView
.
bottom
-
c
.
rcView
.
top
;
editor
->
nTotalLength
=
c
.
pt
.
y
;
editor
->
pBuffer
->
pLast
->
member
.
para
.
nYPos
=
yLastPos
;
ME_DestroyContext
(
&
c
,
editor
->
hWnd
);
...
...
dlls/riched32/tests/editor.c
View file @
3cc6e236
...
...
@@ -696,6 +696,75 @@ static void test_EM_FINDTEXT(void)
DestroyWindow
(
hwndRichEdit
);
}
static
void
test_EM_POSFROMCHAR
(
void
)
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
unsigned
int
i
;
POINTL
pl
;
LRESULT
result
;
unsigned
int
height
=
0
;
unsigned
int
xpos
=
0
;
/* Fill the control to lines to ensure that most of them are offscreen */
for
(
i
=
0
;
i
<
50
;
i
++
)
{
/* Do not modify the string; it is exactly 16 characters long. */
SendMessage
(
hwndRichEdit
,
EM_SETSEL
,
0
,
0
);
SendMessage
(
hwndRichEdit
,
EM_REPLACESEL
,
0
,
(
LPARAM
)
"0123456789ABCD
\r\n
"
);
}
/*
Richedit 1.0 receives a POINTL* on wParam and character offset on lParam, returns void.
Richedit 2.0 receives character offset on wParam, ignores lParam, returns MAKELONG(x,y)
Richedit 3.0 accepts either of the above API conventions.
*/
/* Testing Richedit 1.0 API format */
/* Testing start of lines. X-offset should be constant on all cases (native is 1).
Since all lines are identical and drawn with the same font,
they should have the same height... right?
*/
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
);
if
(
i
==
0
)
{
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
;
}
else
if
(
i
==
1
)
{
ok
(
pl
.
y
>
0
,
"EM_POSFROMCHAR reports y=%d, expected > 0
\n
"
,
pl
.
y
);
ok
(
pl
.
x
==
xpos
,
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
pl
.
x
);
height
=
pl
.
y
;
}
else
{
ok
(
pl
.
y
==
i
*
height
,
"EM_POSFROMCHAR reports y=%d, expected %d
\n
"
,
pl
.
y
,
i
*
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
*
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 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
*
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
);
DestroyWindow
(
hwndRichEdit
);
}
START_TEST
(
editor
)
...
...
@@ -717,6 +786,7 @@ START_TEST( editor )
test_EM_GETLINE
();
test_EM_LINELENGTH
();
test_EM_FINDTEXT
();
test_EM_POSFROMCHAR
();
/* Set the environment variable WINETEST_RICHED32 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
...
...
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