# Test scenario for session/session_handler_scenario_test

# Tests for InsertCharacter, Insert*Space, Delete, Backspace, MoveCursor*

#############################
# Composition(Preedit)

SEND_KEY	ON
SET_CONFIG	preedit_method	ROMAN
SWITCH_INPUT_MODE	HIRAGANA

# MS-IME
SET_CONFIG	session_keymap	MSIME
SEND_KEYS	a
EXPECT_PREEDIT	あ
SEND_KEY	CTRL SPACE
SEND_KEYS	a
EXPECT_PREEDIT	あ あ
SEND_KEY	CTRL SHIFT SPACE
SEND_KEYS	a
EXPECT_PREEDIT	あ あ　あ
SEND_KEY	BACKSPACE
EXPECT_PREEDIT	あ あ　
SEND_KEY	DELETE
# Nothing happens
EXPECT_PREEDIT	あ あ　
SEND_KEY	LEFT
SEND_KEY	DELETE
EXPECT_PREEDIT	あ あ
SEND_KEY	HOME
SEND_KEY	BACKSPACE
# Nothing happens
EXPECT_PREEDIT	あ あ
SEND_KEY	DELETE
EXPECT_PREEDIT	 あ

# (Left, Right): (LEFT, RIGHT), (CTRL s, CTRL d), (CTRL k, CTRL l),
#                (SHIFT LEFT, SHIFT RIGHT)
# (Beginning, End): (HOME, END), (CTRL a, CTRL f), (CTRL e, CTRL x),
#                   (CTRL LEFT, CTRL RIGHT), (CTRL UP, CTRL DOWN),
#                   (_, CTRL x), (_, CTRL n)
RESET_CONTEXT
SEND_KEYS	aiueo
EXPECT_PREEDIT	あいうえお
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	LEFT
EXPECT_PREEDIT_CURSOR_POS	4
SEND_KEY	RIGHT
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL s
EXPECT_PREEDIT_CURSOR_POS	4
SEND_KEY	CTRL d
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL k
EXPECT_PREEDIT_CURSOR_POS	4
SEND_KEY	CTRL l
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	SHIFT LEFT
EXPECT_PREEDIT_CURSOR_POS	4
SEND_KEY	SHIFT RIGHT
EXPECT_PREEDIT_CURSOR_POS	5

SEND_KEY	HOME
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	END
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL a
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	CTRL f
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL e
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	CTRL x
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL LEFT
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	CTRL RIGHT
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL UP
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	CTRL DOWN
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	HOME
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	CTRL x
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	HOME
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	CTRL n
EXPECT_PREEDIT_CURSOR_POS	5

# KOTOERI
RESET_CONTEXT
SET_CONFIG	session_keymap	KOTOERI
SEND_KEYS	a
EXPECT_PREEDIT	あ
SEND_KEY	OPTION SPACE
SEND_KEYS	a
EXPECT_PREEDIT	あ　あ
SEND_KEY	BACKSPACE
EXPECT_PREEDIT	あ　
SEND_KEY	DELETE
# Nothing happen
EXPECT_PREEDIT	あ　
SEND_KEY	LEFT
SEND_KEY	DELETE
EXPECT_PREEDIT	あ
SEND_KEY	LEFT
SEND_KEY	BACKSPACE
EXPECT_PREEDIT	あ

# (Left, Right): (LEFT, RIGHT), (CTRL b, CTRL f), (OPTION j, OPTION l),
# (Beginning, End): (HOME, END), (CTRL a, CTRL e), (CTRL LEFT, CTRL RIGHT)
RESET_CONTEXT
SEND_KEYS	aiueo
EXPECT_PREEDIT	あいうえお
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	LEFT
EXPECT_PREEDIT_CURSOR_POS	4
SEND_KEY	RIGHT
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL b
EXPECT_PREEDIT_CURSOR_POS	4
SEND_KEY	CTRL f
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	OPTION j
EXPECT_PREEDIT_CURSOR_POS	4
SEND_KEY	OPTION l
EXPECT_PREEDIT_CURSOR_POS	5

SEND_KEY	HOME
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	END
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL a
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	CTRL e
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL LEFT
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	CTRL RIGHT
EXPECT_PREEDIT_CURSOR_POS	5

RESET_CONTEXT
SET_CONFIG	session_keymap	ATOK
SEND_KEYS	aa
EXPECT_PREEDIT	ああ
SEND_KEY	BACKSPACE
EXPECT_PREEDIT	あ
SEND_KEY	DELETE
# Nothing happen
EXPECT_PREEDIT	あ
SEND_KEY	LEFT
SEND_KEY	BACKSPACE
EXPECT_PREEDIT	あ
SEND_KEY	DELETE
EXPECT_PREEDIT	

# (Left, Right): (LEFT, RIGHT), (CTRL k, CTRL l)
# (Beginning, End): (CTRL LEFT, CTRL RIGHT)
RESET_CONTEXT
SEND_KEYS	aiueo
EXPECT_PREEDIT	あいうえお
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	LEFT
EXPECT_PREEDIT_CURSOR_POS	4
SEND_KEY	RIGHT
EXPECT_PREEDIT_CURSOR_POS	5
SEND_KEY	CTRL k
EXPECT_PREEDIT_CURSOR_POS	4
SEND_KEY	CTRL l
EXPECT_PREEDIT_CURSOR_POS	5

SEND_KEY	CTRL LEFT
EXPECT_PREEDIT_CURSOR_POS	0
SEND_KEY	CTRL RIGHT
EXPECT_PREEDIT_CURSOR_POS	5

#############################
# Conversion

# MS-IME
RESET_CONTEXT
SET_CONFIG	session_keymap	MSIME
SEND_KEYS	a
EXPECT_PREEDIT	あ
SEND_KEY	SPACE
EXPECT_PREEDIT	あ
SEND_KEY	CTRL SHIFT SPACE
EXPECT_RESULT	あ　

SEND_KEYS	a
EXPECT_PREEDIT	あ
SEND_KEY	SPACE
EXPECT_PREEDIT	あ
SEND_KEY	CTRL SPACE
EXPECT_RESULT	あ 

# KOTOERI, ATOK have no keymap for Insertion in Conversion.

#############################
# Insert Space
# MS-IME

RESET_CONTEXT
SET_CONFIG	preedit_method	ROMAN
SET_CONFIG	session_keymap	MSIME
SEND_KEY	ON

RESET_CONTEXT
SWITCH_INPUT_MODE	HIRAGANA
SEND_KEY	SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　
SEND_KEY	CTRL SHIFT SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　
SEND_KEY	SHIFT SPACE
EXPECT_PREEDIT
# Half width space in result
EXPECT_RESULT	 

RESET_CONTEXT
SWITCH_INPUT_MODE	FULL_ASCII
SEND_KEY	SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　
SEND_KEY	CTRL SHIFT SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　
SEND_KEY	SHIFT SPACE
EXPECT_PREEDIT
# Half width space in result
EXPECT_RESULT	 

RESET_CONTEXT
SWITCH_INPUT_MODE	FULL_KATAKANA
SEND_KEY	SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　
SEND_KEY	CTRL SHIFT SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　
SEND_KEY	SHIFT SPACE
EXPECT_PREEDIT
# Half width space in result
EXPECT_RESULT	 

RESET_CONTEXT
SWITCH_INPUT_MODE	HALF_ASCII
SEND_KEY	SPACE
# Space will be passed directly
EXPECT_PREEDIT
EXPECT_RESULT
EXPECT_CONSUMED	false
SEND_KEY	CTRL SHIFT SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　
SEND_KEY	SHIFT SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　

RESET_CONTEXT
SWITCH_INPUT_MODE	HALF_KATAKANA
SEND_KEY	SPACE
# Space will be passed directly
EXPECT_PREEDIT
EXPECT_RESULT
EXPECT_CONSUMED	false
SEND_KEY	CTRL SHIFT SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　
SEND_KEY	SHIFT SPACE
EXPECT_PREEDIT
# Full width space in result
EXPECT_RESULT	　

