Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
d17e1d31
Commit
d17e1d31
authored
10 years ago
by
Jean Chalard
Browse files
Options
Downloads
Patches
Plain Diff
Add some gesture-move tests
Change-Id: I5ec9a9169b0d27da93194e1bd3fa90da8174ee8f
parent
d5455fea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/com/android/inputmethod/latin/InputLogicTests.java
+32
-2
32 additions, 2 deletions
tests/src/com/android/inputmethod/latin/InputLogicTests.java
with
32 additions
and
2 deletions
tests/src/com/android/inputmethod/latin/InputLogicTests.java
+
32
−
2
View file @
d17e1d31
...
...
@@ -674,10 +674,15 @@ public class InputLogicTests extends InputTestsBase {
mEditText
.
getText
().
toString
());
}
private
void
typeWordAndPutCursorInside
(
final
String
word
,
final
int
startPos
)
{
private
void
typeOrGestureWordAndPutCursorInside
(
final
boolean
gesture
,
final
String
word
,
final
int
startPos
)
{
final
int
END_OF_WORD
=
startPos
+
word
.
length
();
final
int
NEW_CURSOR_POSITION
=
startPos
+
word
.
length
()
/
2
;
type
(
word
);
if
(
gesture
)
{
gesture
(
word
);
}
else
{
type
(
word
);
}
sendUpdateForCursorMoveTo
(
END_OF_WORD
);
runMessages
();
sendUpdateForCursorMoveTo
(
NEW_CURSOR_POSITION
);
...
...
@@ -687,6 +692,14 @@ public class InputLogicTests extends InputTestsBase {
startPos
,
END_OF_WORD
);
}
private
void
typeWordAndPutCursorInside
(
final
String
word
,
final
int
startPos
)
{
typeOrGestureWordAndPutCursorInside
(
false
/* gesture */
,
word
,
startPos
);
}
private
void
gestureWordAndPutCursorInside
(
final
String
word
,
final
int
startPos
)
{
typeOrGestureWordAndPutCursorInside
(
true
/* gesture */
,
word
,
startPos
);
}
private
void
ensureComposingSpanPos
(
final
String
message
,
final
int
from
,
final
int
to
)
{
assertEquals
(
message
,
from
,
BaseInputConnection
.
getComposingSpanStart
(
mEditText
.
getText
()));
assertEquals
(
message
,
to
,
BaseInputConnection
.
getComposingSpanEnd
(
mEditText
.
getText
()));
...
...
@@ -703,6 +716,23 @@ public class InputLogicTests extends InputTestsBase {
int
cursorPos
=
sendUpdateForCursorMoveToEndOfLine
();
runMessages
();
type
(
" "
);
assertEquals
(
"mbo"
,
"some thing "
,
mEditText
.
getText
().
toString
());
typeWordAndPutCursorInside
(
WORD_TO_TYPE
,
cursorPos
+
1
/* startPos */
);
type
(
Constants
.
CODE_DELETE
);
ensureComposingSpanPos
(
"space while in the middle of a word cancels composition"
,
-
1
,
-
1
);
}
public
void
testTypeWithinGestureComposing
()
{
final
String
WORD_TO_TYPE
=
"something"
;
final
String
EXPECTED_RESULT
=
"some thing"
;
gestureWordAndPutCursorInside
(
WORD_TO_TYPE
,
0
/* startPos */
);
type
(
" "
);
ensureComposingSpanPos
(
"space while in the middle of a word cancels composition"
,
-
1
,
-
1
);
assertEquals
(
"space in the middle of a composing word"
,
EXPECTED_RESULT
,
mEditText
.
getText
().
toString
());
int
cursorPos
=
sendUpdateForCursorMoveToEndOfLine
();
runMessages
();
type
(
" "
);
typeWordAndPutCursorInside
(
WORD_TO_TYPE
,
cursorPos
+
1
/* startPos */
);
type
(
Constants
.
CODE_DELETE
);
ensureComposingSpanPos
(
"space while in the middle of a word cancels composition"
,
-
1
,
-
1
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment