1024 | 1024 |
EXPECT_EQ(DictionaryPredictor::REALTIME,
|
1025 | 1025 |
DictionaryPredictor::GetPredictionTypes(*convreq_, segments));
|
1026 | 1026 |
}
|
|
1027 |
|
|
1028 |
// When romaji table is qwerty mobile => ENGLISH is included depending on the
|
|
1029 |
// language aware input setting.
|
|
1030 |
{
|
|
1031 |
const auto orig_input_mode = composer_->GetInputMode();
|
|
1032 |
const auto orig_table = request_->special_romanji_table();
|
|
1033 |
const auto orig_lang_aware = request_->language_aware_input();
|
|
1034 |
const bool orig_use_dictionary_suggest = config_->use_dictionary_suggest();
|
|
1035 |
|
|
1036 |
composer_->SetInputMode(transliteration::HIRAGANA);
|
|
1037 |
config_->set_use_dictionary_suggest(true);
|
|
1038 |
|
|
1039 |
// The case where romaji table is set to qwerty. ENGLISH is turned on if
|
|
1040 |
// language aware input is enabled.
|
|
1041 |
for (const auto table :
|
|
1042 |
{commands::Request::QWERTY_MOBILE_TO_HIRAGANA,
|
|
1043 |
commands::Request::QWERTY_MOBILE_TO_HALFWIDTHASCII}) {
|
|
1044 |
request_->set_special_romanji_table(table);
|
|
1045 |
|
|
1046 |
// Language aware input is default: No English prediction.
|
|
1047 |
request_->set_language_aware_input(
|
|
1048 |
commands::Request::DEFAULT_LANGUAGE_AWARE_BEHAVIOR);
|
|
1049 |
auto type = DictionaryPredictor::GetPredictionTypes(*convreq_, segments);
|
|
1050 |
EXPECT_EQ(0, type & DictionaryPredictor::ENGLISH);
|
|
1051 |
|
|
1052 |
// Language aware input is off: No English prediction.
|
|
1053 |
request_->set_language_aware_input(
|
|
1054 |
commands::Request::NO_LANGUAGE_AWARE_INPUT);
|
|
1055 |
type = DictionaryPredictor::GetPredictionTypes(*convreq_, segments);
|
|
1056 |
EXPECT_EQ(0, type & DictionaryPredictor::ENGLISH);
|
|
1057 |
|
|
1058 |
// Language aware input is on: English prediction is included.
|
|
1059 |
request_->set_language_aware_input(
|
|
1060 |
commands::Request::LANGUAGE_AWARE_SUGGESTION);
|
|
1061 |
type = DictionaryPredictor::GetPredictionTypes(*convreq_, segments);
|
|
1062 |
EXPECT_EQ(DictionaryPredictor::ENGLISH,
|
|
1063 |
type & DictionaryPredictor::ENGLISH);
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
// The case where romaji table is not qwerty. ENGLISH is turned off
|
|
1067 |
// regardless of language aware input setting.
|
|
1068 |
for (const auto table : {
|
|
1069 |
commands::Request::FLICK_TO_HALFWIDTHASCII,
|
|
1070 |
commands::Request::FLICK_TO_HIRAGANA,
|
|
1071 |
commands::Request::GODAN_TO_HALFWIDTHASCII,
|
|
1072 |
commands::Request::GODAN_TO_HIRAGANA,
|
|
1073 |
commands::Request::NOTOUCH_TO_HALFWIDTHASCII,
|
|
1074 |
commands::Request::NOTOUCH_TO_HIRAGANA,
|
|
1075 |
commands::Request::TOGGLE_FLICK_TO_HALFWIDTHASCII,
|
|
1076 |
commands::Request::TOGGLE_FLICK_TO_HIRAGANA,
|
|
1077 |
commands::Request::TWELVE_KEYS_TO_HALFWIDTHASCII,
|
|
1078 |
commands::Request::TWELVE_KEYS_TO_HIRAGANA,
|
|
1079 |
}) {
|
|
1080 |
request_->set_special_romanji_table(table);
|
|
1081 |
|
|
1082 |
// Language aware input is default.
|
|
1083 |
request_->set_language_aware_input(
|
|
1084 |
commands::Request::DEFAULT_LANGUAGE_AWARE_BEHAVIOR);
|
|
1085 |
auto type = DictionaryPredictor::GetPredictionTypes(*convreq_, segments);
|
|
1086 |
EXPECT_EQ(0, type & DictionaryPredictor::ENGLISH);
|
|
1087 |
|
|
1088 |
// Language aware input is off.
|
|
1089 |
request_->set_language_aware_input(
|
|
1090 |
commands::Request::NO_LANGUAGE_AWARE_INPUT);
|
|
1091 |
type = DictionaryPredictor::GetPredictionTypes(*convreq_, segments);
|
|
1092 |
EXPECT_EQ(0, type & DictionaryPredictor::ENGLISH);
|
|
1093 |
|
|
1094 |
// Language aware input is on.
|
|
1095 |
request_->set_language_aware_input(
|
|
1096 |
commands::Request::LANGUAGE_AWARE_SUGGESTION);
|
|
1097 |
type = DictionaryPredictor::GetPredictionTypes(*convreq_, segments);
|
|
1098 |
EXPECT_EQ(0, type & DictionaryPredictor::ENGLISH);
|
|
1099 |
}
|
|
1100 |
|
|
1101 |
config_->set_use_dictionary_suggest(orig_use_dictionary_suggest);
|
|
1102 |
request_->set_language_aware_input(orig_lang_aware);
|
|
1103 |
request_->set_special_romanji_table(orig_table);
|
|
1104 |
composer_->SetInputMode(orig_input_mode);
|
|
1105 |
}
|
1027 | 1106 |
}
|
1028 | 1107 |
|
1029 | 1108 |
TEST_F(DictionaryPredictorTest, GetPredictionTypesTestWithTypingCorrection) {
|