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
55ffeeee
Commit
55ffeeee
authored
Jan 25, 2011
by
Greg Geldorp
Committed by
Alexandre Julliard
Jan 25, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched32/tests: Fix editor tests.
parent
02be0aee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
23 deletions
+45
-23
editor.c
dlls/riched32/tests/editor.c
+45
-23
No files found.
dlls/riched32/tests/editor.c
View file @
55ffeeee
...
...
@@ -38,7 +38,7 @@ static HMODULE hmoduleRichEdit;
static
HWND
new_window
(
LPCTSTR
lpClassName
,
DWORD
dwStyle
,
HWND
parent
)
{
HWND
hwnd
;
hwnd
=
CreateWindow
(
lpClassName
,
NULL
,
dwStyle
|
WS_POPUP
|
WS_HSCROLL
|
WS_VSCROLL
|
WS_VISIBLE
,
0
,
0
,
2
00
,
60
,
parent
,
NULL
,
|
WS_VISIBLE
,
0
,
0
,
5
00
,
60
,
parent
,
NULL
,
hmoduleRichEdit
,
NULL
);
ok
(
hwnd
!=
NULL
,
"class: %s, error: %d
\n
"
,
lpClassName
,
(
int
)
GetLastError
());
return
hwnd
;
...
...
@@ -48,32 +48,42 @@ static HWND new_richedit(HWND parent) {
return
new_window
(
RICHEDIT_CLASS10A
,
ES_MULTILINE
,
parent
);
}
static
BOOL
is_rtl
(
void
)
{
LOCALESIGNATURE
sig
;
return
(
GetLocaleInfoA
(
LOCALE_USER_DEFAULT
,
LOCALE_FONTSIGNATURE
,
(
LPSTR
)
&
sig
,
sizeof
(
LOCALESIGNATURE
))
&&
(
sig
.
lsUsb
[
3
]
&
0x08000000
)
!=
0
);
}
static
void
test_WM_SETTEXT
(
void
)
{
static
const
struct
{
const
char
*
itemtext
;
DWORD
lines
;
DWORD
lines_rtl
;
DWORD
lines_broken
;
}
testitems
[]
=
{
{
"TestSomeText"
,
1
},
{
"TestSomeText
\r
"
,
1
},
{
"TestSomeText
\r
SomeMoreText
\r
"
,
2
,
1
},
/* NT4 and below */
{
"TestSomeText
\n\n
TestSomeText"
,
3
},
{
"TestSomeText
\r\r\n
TestSomeText"
,
2
},
{
"TestSomeText
\r\r\n\r
TestSomeText"
,
3
,
2
},
/* NT4 and below */
{
"TestSomeText
\r\n\r\r\n\r
TestSomeText"
,
4
,
3
},
/* NT4 and below */
{
"TestSomeText
\r\n
"
,
2
},
{
"TestSomeText
\r\n
SomeMoreText
\r\n
"
,
3
},
{
"TestSomeText
\r\n\r\n
TestSomeText"
,
3
},
{
"TestSomeText TestSomeText"
,
1
},
{
"TestSomeText
\r\n
TestSomeText"
,
2
},
{
"TestSomeText
\r\n
\r\n
TestSomeText"
,
3
},
{
"TestSomeText
\n
"
,
2
},
{
"TestSomeText
\r\r\r
"
,
3
,
1
},
/* NT4 and below */
{
"TestSomeText
\r\r\r
SomeMoreText"
,
4
,
2
}
/* NT4 and below */
{
"TestSomeText"
,
1
,
1
},
{
"TestSomeText
\r
"
,
1
,
1
},
{
"TestSomeText
\r
SomeMoreText
\r
"
,
2
,
1
,
1
},
/* NT4 and below */
{
"TestSomeText
\n\n
TestSomeText"
,
3
,
3
},
{
"TestSomeText
\r\r\n
TestSomeText"
,
2
,
2
},
{
"TestSomeText
\r\r\n\r
TestSomeText"
,
3
,
2
,
2
},
/* NT4 and below */
{
"TestSomeText
\r\n\r\r\n\r
TestSomeText"
,
4
,
3
,
3
},
/* NT4 and below */
{
"TestSomeText
\r\n
"
,
2
,
2
},
{
"TestSomeText
\r\n
SomeMoreText
\r\n
"
,
3
,
3
},
{
"TestSomeText
\r\n\r\n
TestSomeText"
,
3
,
3
},
{
"TestSomeText TestSomeText"
,
1
,
1
},
{
"TestSomeText
\r\n
TestSomeText"
,
2
,
2
},
{
"TestSomeText
\r\n
\r\n
TestSomeText"
,
3
,
3
},
{
"TestSomeText
\n
"
,
2
,
2
},
{
"TestSomeText
\r\r\r
"
,
3
,
1
,
1
},
/* NT4 and below */
{
"TestSomeText
\r\r\r
SomeMoreText"
,
4
,
1
,
1
}
/* NT4 and below */
};
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
int
i
;
BOOL
rtl
=
is_rtl
();
/* This test attempts to show that WM_SETTEXT on a riched32 control does not
* attempt to modify the text that is pasted into the control, and should
...
...
@@ -88,6 +98,8 @@ static void test_WM_SETTEXT(void)
* is, a run of \r{N} without a terminating \n is considered N line breaks
* - \r at the end of the text is NOT a line break. This differs from riched20,
* where \r at the end of the text is a proper line break.
* However, on RTL language versions, \r is simply skipped and never used
* for line breaking (only \n adds a line break)
*/
for
(
i
=
0
;
i
<
sizeof
(
testitems
)
/
sizeof
(
testitems
[
0
]);
i
++
)
{
...
...
@@ -105,7 +117,7 @@ static void test_WM_SETTEXT(void)
ok
(
result
==
0
,
"[%d] WM_SETTEXT round trip: strcmp = %ld
\n
"
,
i
,
result
);
result
=
SendMessage
(
hwndRichEdit
,
EM_GETLINECOUNT
,
0
,
0
);
ok
(
result
==
testitems
[
i
].
lines
||
ok
(
result
==
(
rtl
?
testitems
[
i
].
lines_rtl
:
testitems
[
i
].
lines
)
||
broken
(
testitems
[
i
].
lines_broken
&&
result
==
testitems
[
i
].
lines_broken
),
"[%d] EM_GETLINECOUNT returned %ld, expected %d
\n
"
,
i
,
result
,
testitems
[
i
].
lines
);
}
...
...
@@ -374,6 +386,7 @@ static void test_EM_GETLINE(void)
"
\r\r\n
"
"bar
\n
"
;
BOOL
broken_os
=
FALSE
;
BOOL
rtl
=
is_rtl
();
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
text
);
linecount
=
SendMessage
(
hwndRichEdit
,
EM_GETLINECOUNT
,
0
,
0
);
...
...
@@ -421,9 +434,15 @@ static void test_EM_GETLINE(void)
{
ok
(
!
strncmp
(
dest
,
gl_text
,
expected_bytes_written
),
"%d: expected_bytes_written=%d
\n
"
,
i
,
expected_bytes_written
);
ok
(
!
strncmp
(
dest
+
expected_bytes_written
,
origdest
+
expected_bytes_written
,
nBuf
-
expected_bytes_written
),
"%d: expected_bytes_written=%d
\n
"
,
i
,
expected_bytes_written
);
if
(
!
rtl
||
expected_bytes_written
==
gl
[
i
].
buffer_len
)
ok
(
!
strncmp
(
dest
+
expected_bytes_written
,
origdest
+
expected_bytes_written
,
nBuf
-
expected_bytes_written
),
"%d: expected_bytes_written=%d
\n
"
,
i
,
expected_bytes_written
);
else
ok
(
dest
[
expected_bytes_written
]
==
0
&&
!
strncmp
(
dest
+
expected_bytes_written
+
1
,
origdest
+
expected_bytes_written
+
1
,
nBuf
-
(
expected_bytes_written
+
1
)),
"%d: expected_bytes_written=%d
\n
"
,
i
,
expected_bytes_written
);
}
}
...
...
@@ -730,6 +749,7 @@ static void test_EM_POSFROMCHAR(void)
LRESULT
result
;
unsigned
int
height
=
0
;
int
xpos
=
0
;
int
xpos_rtl_adjusted
=
0
;
static
const
char
text
[]
=
"aa
\n
"
"this is a long line of text that should be longer than the "
"control's width
\n
"
...
...
@@ -772,6 +792,7 @@ static void test_EM_POSFROMCHAR(void)
broken
(
pl
.
x
==
0
),
/* Win9x, WinME and NT4 */
"EM_POSFROMCHAR reports x=%d, expected 1
\n
"
,
pl
.
x
);
xpos
=
pl
.
x
;
xpos_rtl_adjusted
=
xpos
+
(
is_rtl
()
?
7
:
0
);
}
else
if
(
i
==
1
)
{
...
...
@@ -796,7 +817,8 @@ static void test_EM_POSFROMCHAR(void)
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 %d
\n
"
,
pl
.
x
,
xpos
);
ok
(
pl
.
x
==
xpos_rtl_adjusted
,
"EM_POSFROMCHAR reports x=%d, expected %d
\n
"
,
pl
.
x
,
xpos_rtl_adjusted
);
/* Testing that vertical scrolling does, in fact, have an effect on EM_POSFROMCHAR */
...
...
@@ -822,7 +844,7 @@ static void test_EM_POSFROMCHAR(void)
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 %d
\n
"
,
pl
.
x
,
xpos
);
ok
(
pl
.
x
==
xpos
_rtl_adjusted
,
"EM_POSFROMCHAR reports x=%d, expected %d
\n
"
,
pl
.
x
,
xpos_rtl_adjusted
);
/* Testing that horizontal scrolling does, in fact, have an effect on EM_POSFROMCHAR */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
text
);
...
...
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