Skip to content

Commit

Permalink
Deprecate --display_preedit option.
Browse files Browse the repository at this point in the history
client_scenario_test and client_stress_test are no longer intensively
used nowadays.  Probably it makes sense to remove less important options
in favor of maintainability.

With this removal, we can remove EncodingUtil::UTF8ToSJIS completely.

BUG=#252
TEST=unittest
REF_BUG=19010851,18999934
REF_CL=84930641
  • Loading branch information
yukawa committed Oct 25, 2015
1 parent 26f4380 commit f8d08e9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 68 deletions.
29 changes: 0 additions & 29 deletions src/client/client_scenario_test_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@
// events specified by FLAGS_input file or interactive standard input. Input
// file format is same as one of session/session_client_main.

#include <iostream>
#include <string>
#include <vector>

#include "base/encoding_util.h"
#include "base/file_stream.h"
#include "base/file_util.h"
#include "base/flags.h"
Expand All @@ -50,7 +48,6 @@
#include "protocol/renderer_command.pb.h"
#include "renderer/renderer_client.h"

DEFINE_bool(display_preedit, false, "display predit to tty");
DEFINE_string(input, "", "Input file");
DEFINE_int32(key_duration, 10, "Key duration (msec)");
DEFINE_string(profile_dir, "", "Profile dir");
Expand All @@ -62,28 +59,6 @@ DEFINE_bool(test_testsendkey, true, "Test TestSendKey");
namespace mozc {
namespace {

string UTF8ToTtyString(const string &text) {
#ifdef OS_WIN
string tmp;
EncodingUtil::UTF8ToSJIS(text, &tmp);
return tmp;
#else
return text;
#endif
}

void DisplayPreedit(const commands::Output &output) {
if (output.has_preedit()) {
string value;
for (size_t i = 0; i < output.preedit().segment_size(); ++i) {
value += output.preedit().segment(i).value();
}
cout << UTF8ToTtyString(value) << '\r';
} else if (output.has_result()) {
cout << UTF8ToTtyString(output.result().value()) << endl;
}
}

// Parses key events. If |input| gets EOF, returns false.
bool ReadKeys(istream *input,
vector<commands::KeyEvent> *keys,
Expand Down Expand Up @@ -179,10 +154,6 @@ int Loop(istream *input) {
VLOG(2) << "Sending to Renderer: " << renderer_command.DebugString();
renderer_client->ExecCommand(renderer_command);
}

if (FLAGS_display_preedit) {
mozc::DisplayPreedit(output);
}
}
if (!answer.empty() && (output.result().value() != answer)) {
LOG(ERROR) << "wrong value: " << output.result().value()
Expand Down
38 changes: 0 additions & 38 deletions src/client/client_stress_test_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
#include <unistd.h>
#endif // OS_WIN

#include <iostream> // NOLINT

#include "base/encoding_util.h"
#include "base/file_stream.h"
#include "base/flags.h"
#include "base/logging.h"
Expand All @@ -57,42 +54,11 @@ DEFINE_int32(max_keyevents, 100000,
"test at most |max_keyevents| key sequences");
DEFINE_string(server_path, "", "specify server path");
DEFINE_int32(key_duration, 10, "key duration (msec)");
DEFINE_bool(display_preedit, true, "display predit to tty");
DEFINE_bool(test_renderer, false, "test renderer");
DEFINE_bool(test_testsendkey, true, "test TestSendKey");

DECLARE_bool(logtostderr);

namespace mozc {
namespace {

void DisplayPreedit(const commands::Output &output) {
// TODO(taku): display segment attributes
if (output.has_preedit()) {
string value;
for (size_t i = 0; i < output.preedit().segment_size(); ++i) {
value += output.preedit().segment(i).value();
}
#ifdef OS_WIN
string tmp;
EncodingUtil::UTF8ToSJIS(value, &tmp);
cout << tmp << '\r';
#else
cout << value << '\r';
#endif // OS_WIN
} else if (output.has_result()) {
#ifdef OS_WIN
string tmp;
EncodingUtil::UTF8ToSJIS(output.result().value(), &tmp);
cout << tmp << endl;
#else
cout << output.result().value() << endl;
#endif // OS_WIN
}
}
} // namespace
} // namespace mozc

int main(int argc, char **argv) {
InitGoogle(argv[0], &argc, &argv, false);

Expand Down Expand Up @@ -162,10 +128,6 @@ int main(int argc, char **argv) {
client.SendKey(keys[i], &output);
VLOG(2) << "Output of SendKey: " << output.DebugString();

if (FLAGS_display_preedit) {
mozc::DisplayPreedit(output);
}

if (renderer_client.get() != NULL) {
renderer_command.set_type(mozc::commands::RendererCommand::UPDATE);
renderer_command.set_visible(output.has_candidates());
Expand Down
2 changes: 1 addition & 1 deletion src/mozc_version_template.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MAJOR=2
MINOR=17
BUILD=2141
BUILD=2142
REVISION=102
# NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
# downloaded by NaCl Mozc.
Expand Down

0 comments on commit f8d08e9

Please sign in to comment.