Introduce a utility method to test IME APIs.

This CL introduces a utility method that helps us to describe what is
the initial state of InputConnection and what is the expected state of
the InputConnection after some APIs are called on that.

With this utility method, you can use meta characters to indicate text
selection range and surrogate characters.  For example, "012[3<>67]89"
will be converted into 10-length text "0123HL6789", where "H" and "L"
indicate certain high and low surrogate characters, respectively, with
selecting "3HL67".  This would be particularly useful to test some tricky
situations where we have to pay special attention to surrogate pairs.
For instance, you can describe a text where the cursor is positioned in
the middle of the surrogate pair like "Do you know this emoji <[]>?".

This CL also updates testDeleteSurroundingText() by using the utility
with some additional test cases for surrogate characters.

Bug: 6526420
Change-Id: Ib36e3a6dda884f74a3f26cf9c26a0f4ec56b6755
2 files changed