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
88a9ca7c
Commit
88a9ca7c
authored
Jun 23, 2008
by
Dylan Smith
Committed by
Alexandre Julliard
Jun 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Tests for undo coalescing.
Tests for undo coalescing from previous patches sent as suggested by Alex Villacís Lasso.
parent
6f9f01f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
132 additions
and
0 deletions
+132
-0
editor.c
dlls/riched20/tests/editor.c
+132
-0
No files found.
dlls/riched20/tests/editor.c
View file @
88a9ca7c
...
...
@@ -4265,6 +4265,137 @@ static void test_WM_NOTIFY(void)
DestroyWindow
(
parent
);
}
static
void
simulate_typing_characters
(
HWND
hwnd
,
const
char
*
szChars
)
{
int
ret
;
while
(
*
szChars
!=
'\0'
)
{
SendMessageA
(
hwnd
,
WM_KEYDOWN
,
*
szChars
,
1
);
ret
=
SendMessageA
(
hwnd
,
WM_CHAR
,
*
szChars
,
1
);
ok
(
ret
==
0
,
"WM_CHAR('%c') ret=%d
\n
"
,
*
szChars
,
ret
);
SendMessageA
(
hwnd
,
WM_KEYUP
,
*
szChars
,
1
);
szChars
++
;
}
}
static
void
test_undo_coalescing
(
void
)
{
HWND
hwnd
;
int
result
;
char
buffer
[
64
]
=
{
0
};
/* multi-line control inserts CR normally */
hwnd
=
CreateWindowExA
(
0
,
"RichEdit20W"
,
NULL
,
WS_POPUP
|
ES_MULTILINE
,
0
,
0
,
200
,
60
,
0
,
0
,
0
,
0
);
ok
(
hwnd
!=
0
,
"CreateWindowExA error %u
\n
"
,
GetLastError
());
result
=
SendMessage
(
hwnd
,
EM_CANUNDO
,
0
,
0
);
ok
(
result
==
FALSE
,
"Can undo after window creation.
\n
"
);
result
=
SendMessage
(
hwnd
,
EM_UNDO
,
0
,
0
);
ok
(
result
==
FALSE
,
"Undo operation successful with nothing to undo.
\n
"
);
result
=
SendMessage
(
hwnd
,
EM_CANREDO
,
0
,
0
);
ok
(
result
==
FALSE
,
"Can redo after window creation.
\n
"
);
result
=
SendMessage
(
hwnd
,
EM_REDO
,
0
,
0
);
ok
(
result
==
FALSE
,
"Redo operation successful with nothing undone.
\n
"
);
/* Test the effect of arrows keys during typing on undo transactions*/
simulate_typing_characters
(
hwnd
,
"one two three"
);
SendMessage
(
hwnd
,
WM_KEYDOWN
,
VK_RIGHT
,
1
);
SendMessage
(
hwnd
,
WM_KEYUP
,
VK_RIGHT
,
1
);
simulate_typing_characters
(
hwnd
,
" four five six"
);
result
=
SendMessage
(
hwnd
,
EM_CANREDO
,
0
,
0
);
ok
(
result
==
FALSE
,
"Can redo before anything is undone.
\n
"
);
result
=
SendMessage
(
hwnd
,
EM_CANUNDO
,
0
,
0
);
ok
(
result
==
TRUE
,
"Cannot undo typed characters.
\n
"
);
result
=
SendMessage
(
hwnd
,
EM_UNDO
,
0
,
0
);
todo_wine
ok
(
result
==
TRUE
,
"EM_UNDO Failed to undo typed characters.
\n
"
);
result
=
SendMessage
(
hwnd
,
EM_CANREDO
,
0
,
0
);
ok
(
result
==
TRUE
,
"Cannot redo after undo.
\n
"
);
SendMessageA
(
hwnd
,
WM_GETTEXT
,
sizeof
(
buffer
),
(
LPARAM
)
buffer
);
result
=
strcmp
(
buffer
,
"one two three"
);
todo_wine
ok
(
result
==
0
,
"expected '%s' but got '%s'
\n
"
,
"one two three"
,
buffer
);
result
=
SendMessage
(
hwnd
,
EM_CANUNDO
,
0
,
0
);
ok
(
result
==
TRUE
,
"Cannot undo typed characters.
\n
"
);
result
=
SendMessage
(
hwnd
,
WM_UNDO
,
0
,
0
);
todo_wine
ok
(
result
==
TRUE
,
"Failed to undo typed characters.
\n
"
);
SendMessageA
(
hwnd
,
WM_GETTEXT
,
sizeof
(
buffer
),
(
LPARAM
)
buffer
);
result
=
strcmp
(
buffer
,
""
);
todo_wine
ok
(
result
==
0
,
"expected '%s' but got '%s'
\n
"
,
""
,
buffer
);
/* Test the effect of focus changes during typing on undo transactions*/
simulate_typing_characters
(
hwnd
,
"one two three"
);
result
=
SendMessage
(
hwnd
,
EM_CANREDO
,
0
,
0
);
ok
(
result
==
FALSE
,
"Redo buffer should have been cleared by typing.
\n
"
);
SendMessage
(
hwnd
,
WM_KILLFOCUS
,
(
WPARAM
)
NULL
,
0
);
SendMessage
(
hwnd
,
WM_SETFOCUS
,
(
WPARAM
)
NULL
,
0
);
simulate_typing_characters
(
hwnd
,
" four five six"
);
result
=
SendMessage
(
hwnd
,
EM_UNDO
,
0
,
0
);
todo_wine
ok
(
result
==
TRUE
,
"Failed to undo typed characters.
\n
"
);
SendMessageA
(
hwnd
,
WM_GETTEXT
,
sizeof
(
buffer
),
(
LPARAM
)
buffer
);
result
=
strcmp
(
buffer
,
"one two three"
);
todo_wine
ok
(
result
==
0
,
"expected '%s' but got '%s'
\n
"
,
"one two three"
,
buffer
);
/* Test the effect of the back key during typing on undo transactions */
SendMessage
(
hwnd
,
EM_EMPTYUNDOBUFFER
,
0
,
0
);
result
=
SendMessageA
(
hwnd
,
WM_SETTEXT
,
0
,
(
LPARAM
)
""
);
ok
(
result
==
TRUE
,
"Failed to clear the text.
\n
"
);
simulate_typing_characters
(
hwnd
,
"one two threa"
);
result
=
SendMessage
(
hwnd
,
EM_CANREDO
,
0
,
0
);
ok
(
result
==
FALSE
,
"Redo buffer should have been cleared by typing.
\n
"
);
SendMessage
(
hwnd
,
WM_KEYDOWN
,
VK_BACK
,
1
);
SendMessage
(
hwnd
,
WM_KEYUP
,
VK_BACK
,
1
);
simulate_typing_characters
(
hwnd
,
"e four five six"
);
result
=
SendMessage
(
hwnd
,
EM_UNDO
,
0
,
0
);
todo_wine
ok
(
result
==
TRUE
,
"Failed to undo typed characters.
\n
"
);
SendMessageA
(
hwnd
,
WM_GETTEXT
,
sizeof
(
buffer
),
(
LPARAM
)
buffer
);
result
=
strcmp
(
buffer
,
""
);
todo_wine
ok
(
result
==
0
,
"expected '%s' but got '%s'
\n
"
,
""
,
buffer
);
/* Test the effect of the delete key during typing on undo transactions */
SendMessage
(
hwnd
,
EM_EMPTYUNDOBUFFER
,
0
,
0
);
result
=
SendMessageA
(
hwnd
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"abcd"
);
ok
(
result
==
TRUE
,
"Failed to set the text.
\n
"
);
SendMessage
(
hwnd
,
EM_SETSEL
,
(
WPARAM
)
1
,
(
LPARAM
)
1
);
SendMessage
(
hwnd
,
WM_KEYDOWN
,
VK_DELETE
,
1
);
SendMessage
(
hwnd
,
WM_KEYUP
,
VK_DELETE
,
1
);
SendMessage
(
hwnd
,
WM_KEYDOWN
,
VK_DELETE
,
1
);
SendMessage
(
hwnd
,
WM_KEYUP
,
VK_DELETE
,
1
);
result
=
SendMessage
(
hwnd
,
EM_UNDO
,
0
,
0
);
todo_wine
ok
(
result
==
TRUE
,
"Failed to undo typed characters.
\n
"
);
SendMessageA
(
hwnd
,
WM_GETTEXT
,
sizeof
(
buffer
),
(
LPARAM
)
buffer
);
result
=
strcmp
(
buffer
,
"acd"
);
ok
(
result
==
0
,
"expected '%s' but got '%s'
\n
"
,
"acd"
,
buffer
);
result
=
SendMessage
(
hwnd
,
EM_UNDO
,
0
,
0
);
todo_wine
ok
(
result
==
TRUE
,
"Failed to undo typed characters.
\n
"
);
SendMessageA
(
hwnd
,
WM_GETTEXT
,
sizeof
(
buffer
),
(
LPARAM
)
buffer
);
result
=
strcmp
(
buffer
,
"abcd"
);
ok
(
result
==
0
,
"expected '%s' but got '%s'
\n
"
,
"abcd"
,
buffer
);
/* Test the effect of EM_STOPGROUPTYPING on undo transactions*/
SendMessage
(
hwnd
,
EM_EMPTYUNDOBUFFER
,
0
,
0
);
result
=
SendMessageA
(
hwnd
,
WM_SETTEXT
,
0
,
(
LPARAM
)
""
);
ok
(
result
==
TRUE
,
"Failed to clear the text.
\n
"
);
simulate_typing_characters
(
hwnd
,
"one two three"
);
result
=
SendMessage
(
hwnd
,
EM_STOPGROUPTYPING
,
0
,
0
);
ok
(
result
==
0
,
"expected %d but got %d
\n
"
,
0
,
result
);
simulate_typing_characters
(
hwnd
,
" four five six"
);
result
=
SendMessage
(
hwnd
,
EM_UNDO
,
0
,
0
);
todo_wine
ok
(
result
==
TRUE
,
"Failed to undo typed characters.
\n
"
);
SendMessageA
(
hwnd
,
WM_GETTEXT
,
sizeof
(
buffer
),
(
LPARAM
)
buffer
);
result
=
strcmp
(
buffer
,
"one two three"
);
todo_wine
ok
(
result
==
0
,
"expected '%s' but got '%s'
\n
"
,
"one two three"
,
buffer
);
result
=
SendMessage
(
hwnd
,
EM_UNDO
,
0
,
0
);
todo_wine
ok
(
result
==
TRUE
,
"Failed to undo typed characters.
\n
"
);
todo_wine
ok
(
result
==
TRUE
,
"Failed to undo typed characters.
\n
"
);
SendMessageA
(
hwnd
,
WM_GETTEXT
,
sizeof
(
buffer
),
(
LPARAM
)
buffer
);
result
=
strcmp
(
buffer
,
""
);
todo_wine
ok
(
result
==
0
,
"expected '%s' but got '%s'
\n
"
,
""
,
buffer
);
DestroyWindow
(
hwnd
);
}
START_TEST
(
editor
)
{
MSG
msg
;
...
...
@@ -4310,6 +4441,7 @@ START_TEST( editor )
test_WM_NOTIFY
();
test_EM_AUTOURLDETECT
();
test_eventMask
();
test_undo_coalescing
();
/* Set the environment variable WINETEST_RICHED20 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