Codebase list mozc / 774ff70
Suppress ZeroQuery suggestion when necessary. With this CL ZeroQuery suggestion is suppressed when commiting texts by moving cursor to the left. BUG= TEST=unittest REF_BUG=23800700 REF_CL=103062136 Kohsuke Yatoh authored 8 years ago Yohei Yukawa committed 8 years ago
3 changed file(s) with 56 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
00 MAJOR=2
11 MINOR=17
2 BUILD=2294
2 BUILD=2295
33 REVISION=102
44 # NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
55 # downloaded by NaCl Mozc.
23812381 if (context_->GetRequest().crossing_edge_behavior() ==
23822382 commands::Request::COMMIT_WITHOUT_CONSUMING &&
23832383 context_->composer().GetCursor() == 0) {
2384 Commit(command);
2384 CommitNotTriggeringZeroQuerySuggest(command);
23852385
23862386 // Move the cursor to the beginning of the values.
23872387 command->mutable_output()->mutable_result()->set_cursor_offset(
86998699 EXPECT_EQ(-4, command.output().result().cursor_offset());
87008700 }
87018701
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
87028756 TEST_F(SessionTest, CommitHead) {
87038757 std::unique_ptr<Session> session(new Session(engine_.get()));
87048758 composer::Table table;