8699 | 8699 |
EXPECT_EQ(-4, command.output().result().cursor_offset());
|
8700 | 8700 |
}
|
8701 | 8701 |
|
|
8702 |
TEST_F(SessionTest, MoveCursorRightWithCommitWithZeroQuerySuggestion) {
|
|
8703 |
std::unique_ptr<Session> session(new Session(engine_.get()));
|
|
8704 |
commands::Request request(*mobile_request_);
|
|
8705 |
request.set_special_romanji_table(
|
|
8706 |
commands::Request::QWERTY_MOBILE_TO_HALFWIDTHASCII);
|
|
8707 |
request.set_crossing_edge_behavior(
|
|
8708 |
commands::Request::COMMIT_WITHOUT_CONSUMING);
|
|
8709 |
SetupZeroQuerySuggestionReady(true, session.get(), &request);
|
|
8710 |
commands::Command command;
|
|
8711 |
|
|
8712 |
InsertCharacterChars("GOOGLE", session.get(), &command);
|
|
8713 |
EXPECT_EQ(6, command.output().preedit().cursor());
|
|
8714 |
command.Clear();
|
|
8715 |
|
|
8716 |
session->MoveCursorRight(&command);
|
|
8717 |
EXPECT_FALSE(command.output().consumed());
|
|
8718 |
ASSERT_TRUE(command.output().has_result());
|
|
8719 |
EXPECT_EQ(commands::Result_ResultType_STRING,
|
|
8720 |
command.output().result().type());
|
|
8721 |
EXPECT_EQ("GOOGLE", command.output().result().value());
|
|
8722 |
EXPECT_EQ(0, command.output().result().cursor_offset());
|
|
8723 |
EXPECT_TRUE(command.output().has_candidates());
|
|
8724 |
EXPECT_EQ(2, command.output().candidates().candidate_size());
|
|
8725 |
}
|
|
8726 |
|
|
8727 |
TEST_F(SessionTest, MoveCursorLeftWithCommitWithZeroQuerySuggestion) {
|
|
8728 |
std::unique_ptr<Session> session(new Session(engine_.get()));
|
|
8729 |
commands::Request request(*mobile_request_);
|
|
8730 |
request.set_special_romanji_table(
|
|
8731 |
commands::Request::QWERTY_MOBILE_TO_HALFWIDTHASCII);
|
|
8732 |
request.set_crossing_edge_behavior(
|
|
8733 |
commands::Request::COMMIT_WITHOUT_CONSUMING);
|
|
8734 |
SetupZeroQuerySuggestionReady(true, session.get(), &request);
|
|
8735 |
commands::Command command;
|
|
8736 |
|
|
8737 |
InsertCharacterChars("GOOGLE", session.get(), &command);
|
|
8738 |
EXPECT_EQ(6, command.output().preedit().cursor());
|
|
8739 |
command.Clear();
|
|
8740 |
for (int i = 5; i >= 0; --i) {
|
|
8741 |
session->MoveCursorLeft(&command);
|
|
8742 |
EXPECT_EQ(i, command.output().preedit().cursor());
|
|
8743 |
command.Clear();
|
|
8744 |
}
|
|
8745 |
|
|
8746 |
session->MoveCursorLeft(&command);
|
|
8747 |
EXPECT_FALSE(command.output().consumed());
|
|
8748 |
ASSERT_TRUE(command.output().has_result());
|
|
8749 |
EXPECT_EQ(commands::Result_ResultType_STRING,
|
|
8750 |
command.output().result().type());
|
|
8751 |
EXPECT_EQ("GOOGLE", command.output().result().value());
|
|
8752 |
EXPECT_EQ(-6, command.output().result().cursor_offset());
|
|
8753 |
EXPECT_FALSE(command.output().has_candidates());
|
|
8754 |
}
|
|
8755 |
|
8702 | 8756 |
TEST_F(SessionTest, CommitHead) {
|
8703 | 8757 |
std::unique_ptr<Session> session(new Session(engine_.get()));
|
8704 | 8758 |
composer::Table table;
|