# This file contains a scenario for testing preedit text when a user uses
# 12-key toggle key layout on mobile.

# Enable IME
SEND_KEY	ON

SET_MOBILE_REQUEST
UPDATE_MOBILE_KEYBOARD	TWELVE_KEYS_TO_HIRAGANA	SPACE_OR_CONVERT_KEEPING_COMPOSITION
SWITCH_INPUT_MODE	HIRAGANA

# Simple toggling on Sa-row. First, in the forward order.
RESET_CONTEXT
SEND_KEYS	3
EXPECT_PREEDIT	さ
SEND_KEYS	3
EXPECT_PREEDIT	し
SEND_KEYS	3
EXPECT_PREEDIT	す
SEND_KEYS	3
EXPECT_PREEDIT	せ
SEND_KEYS	3
EXPECT_PREEDIT	そ
SEND_KEYS	3
EXPECT_PREEDIT	さ

# Then reverse order.
UNDO_OR_REWIND
EXPECT_PREEDIT	そ
UNDO_OR_REWIND
EXPECT_PREEDIT	せ
UNDO_OR_REWIND
EXPECT_PREEDIT	す
UNDO_OR_REWIND
EXPECT_PREEDIT	し
UNDO_OR_REWIND
EXPECT_PREEDIT	さ

# Make sure tapping '3' toggles the last character, not adding a new character.
SEND_KEYS	3
EXPECT_PREEDIT	し

# Test with RIGHT key.
RESET_CONTEXT
SEND_KEYS	3
SEND_KEY	RIGHT
SEND_KEYS	3
EXPECT_PREEDIT	ささ

RESET_CONTEXT
SEND_KEYS	33
SEND_KEY	RIGHT
SEND_KEYS	3
EXPECT_PREEDIT	しさ

RESET_CONTEXT
SEND_KEYS	333
SEND_KEY	RIGHT
SEND_KEYS	3
EXPECT_PREEDIT	すさ

RESET_CONTEXT
SEND_KEYS	3333
SEND_KEY	RIGHT
SEND_KEYS	3
EXPECT_PREEDIT	せさ

RESET_CONTEXT
SEND_KEYS	33333
SEND_KEY	RIGHT
SEND_KEYS	3
EXPECT_PREEDIT	そさ

# Test for Sa-row with voiced mark.
RESET_CONTEXT
SEND_KEYS	3
EXPECT_PREEDIT	さ
SEND_KEYS	*
EXPECT_PREEDIT	ざ
SEND_KEYS	*
EXPECT_PREEDIT	さ
SEND_KEYS	*
EXPECT_PREEDIT	ざ
SEND_KEYS	*
EXPECT_PREEDIT	さ
SEND_KEYS	3
EXPECT_PREEDIT	ささ

RESET_CONTEXT
SEND_KEYS	3*
EXPECT_PREEDIT	ざ
SEND_KEYS	3
EXPECT_PREEDIT	ざさ

RESET_CONTEXT
SEND_KEYS	33
EXPECT_PREEDIT	し
SEND_KEYS	*
EXPECT_PREEDIT	じ
SEND_KEYS	*
EXPECT_PREEDIT	し
SEND_KEYS	*
EXPECT_PREEDIT	じ
SEND_KEYS	*
EXPECT_PREEDIT	し
SEND_KEYS	3
EXPECT_PREEDIT	しさ

RESET_CONTEXT
SEND_KEYS	33*
EXPECT_PREEDIT	じ
SEND_KEYS	3
EXPECT_PREEDIT	じさ

RESET_CONTEXT
SEND_KEYS	333
EXPECT_PREEDIT	す
SEND_KEYS	*
EXPECT_PREEDIT	ず
SEND_KEYS	*
EXPECT_PREEDIT	す
SEND_KEYS	*
EXPECT_PREEDIT	ず
SEND_KEYS	*
EXPECT_PREEDIT	す
SEND_KEYS	3
EXPECT_PREEDIT	すさ

RESET_CONTEXT
SEND_KEYS	333*
EXPECT_PREEDIT	ず
SEND_KEYS	3
EXPECT_PREEDIT	ずさ

RESET_CONTEXT
SEND_KEYS	3333
EXPECT_PREEDIT	せ
SEND_KEYS	*
EXPECT_PREEDIT	ぜ
SEND_KEYS	*
EXPECT_PREEDIT	せ
SEND_KEYS	*
EXPECT_PREEDIT	ぜ
SEND_KEYS	*
EXPECT_PREEDIT	せ
SEND_KEYS	3
EXPECT_PREEDIT	せさ

RESET_CONTEXT
SEND_KEYS	3333*
EXPECT_PREEDIT	ぜ
SEND_KEYS	3
EXPECT_PREEDIT	ぜさ

RESET_CONTEXT
SEND_KEYS	33333
EXPECT_PREEDIT	そ
SEND_KEYS	*
EXPECT_PREEDIT	ぞ
SEND_KEYS	*
EXPECT_PREEDIT	そ
SEND_KEYS	*
EXPECT_PREEDIT	ぞ
SEND_KEYS	*
EXPECT_PREEDIT	そ
SEND_KEYS	3
EXPECT_PREEDIT	そさ

RESET_CONTEXT
SEND_KEYS	33333*
EXPECT_PREEDIT	ぞ
SEND_KEYS	3
EXPECT_PREEDIT	ぞさ
