~ubuntu-branches/ubuntu/oneiric/mozc/oneiric

« back to all changes in this revision

Viewing changes to converter/focus_candidate_handler_test.cc

  • Committer: Bazaar Package Importer
  • Author(s): Nobuhiro Iwamatsu
  • Date: 2010-07-14 03:26:47 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100714032647-13qjisj6m8cm8jdx
Tags: 0.12.410.102-1
* New upstream release (Closes: #588971).
  - Add mozc-server, mozc-utils-gui and scim-mozc packages.
* Update debian/rules.
  Add --gypdir option to build_mozc.py.
* Update debian/control.
  - Bumped standards-version to 3.9.0.
  - Update description.
* Add mozc icon (Closes: #588972).
* Add patch which revises issue 18.
  ibus_mozc_issue18.patch
* kFreeBSD build support.
  support_kfreebsd.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "transliteration/transliteration.h"
34
34
#include "converter/segments.h"
35
35
#include "converter/focus_candidate_handler.h"
 
36
#include "session/config.pb.h"
 
37
#include "session/config_handler.h"
36
38
#include "testing/base/public/gunit.h"
37
39
#include "testing/base/public/googletest.h"
38
40
 
46
48
}
47
49
}  // namespace
48
50
 
49
 
TEST(FocusCandidateHandler, FocusCandidateHandlerInvalidQuery) {
 
51
class FocusCandidateHandlerTest : public testing::Test {
 
52
 protected:
 
53
  virtual void SetUp() {
 
54
    Util::SetUserProfileDirectory(FLAGS_test_tmpdir);
 
55
    config::ConfigHandler::GetDefaultConfig(&default_config_);
 
56
    config::ConfigHandler::SetConfig(default_config_);
 
57
  }
 
58
 
 
59
 private:
 
60
  config::Config default_config_;
 
61
};
 
62
 
 
63
TEST_F(FocusCandidateHandlerTest, FocusCandidateHandlerInvalidQuery) {
50
64
  Segments segments;
51
65
 
52
66
  Segment *seg1 = segments.add_segment();
80
94
  EXPECT_FALSE(FocusCandidateHandler::FocusSegmentValue(&segments, 2, 0));
81
95
}
82
96
 
83
 
TEST(FocusCandidateHandler, FocusCandidateHandlerLeftToRight) {
 
97
TEST_F(FocusCandidateHandlerTest, FocusCandidateHandlerLeftToRight) {
84
98
  Segments segments;
85
99
 
86
100
  Segment *seg1 = segments.add_segment();
125
139
  EXPECT_EQ("\xef\xbd\xa3", seg4->candidate(0).content_value);
126
140
}
127
141
 
128
 
TEST(FocusCandidateHandler, FocusCandidateHandlerRightToLeft) {
 
142
TEST_F(FocusCandidateHandlerTest, FocusCandidateHandlerRightToLeft) {
129
143
  Segments segments;
130
144
 
131
145
  Segment *seg1 = segments.add_segment();
171
185
  EXPECT_EQ("\xef\xbd\xa2", seg1->candidate(0).content_value);
172
186
}
173
187
 
174
 
TEST(FocusCandidateHandler, FocusCandidateHandlerLeftToRightNest) {
 
188
TEST_F(FocusCandidateHandlerTest, FocusCandidateHandlerLeftToRightNest) {
175
189
  Segments segments;
176
190
  Segment *seg[7];
177
191
  for (int i = 0; i < arraysize(seg); ++i) {
227
241
  EXPECT_EQ(")", seg[4]->candidate(0).content_value);
228
242
}
229
243
 
230
 
TEST(FocusCandidateHandler, FocusCandidateHandlerRightToLeftNest) {
 
244
TEST_F(FocusCandidateHandlerTest, FocusCandidateHandlerRightToLeftNest) {
231
245
  Segments segments;
232
246
  Segment *seg[7];
233
247
  for (int i = 0; i < arraysize(seg); ++i) {
282
296
  EXPECT_EQ("(", seg[2]->candidate(0).content_value);
283
297
}
284
298
 
285
 
TEST(FocusCandidateHandler, FocusCandidateHandlerMetaCandidate) {
 
299
TEST_F(FocusCandidateHandlerTest, FocusCandidateHandlerMetaCandidate) {
286
300
  Segments segments;
287
301
  Segment *seg[3];
288
302
  for (int i = 0; i < arraysize(seg); ++i) {
335
349
                                                        invalid_index));
336
350
}
337
351
 
338
 
TEST(FocusCandidateHandler, FocusCandidateHandlerNumber) {
 
352
TEST_F(FocusCandidateHandlerTest, FocusCandidateHandlerNumber) {
339
353
  Segments segments;
340
354
  Segment *seg[7];
341
355
  for (int i = 0; i < arraysize(seg); ++i) {
425
439
  EXPECT_EQ("4",  seg[6]->candidate(0).content_value);  // far from
426
440
}
427
441
 
428
 
TEST(FocusCandidateHandler, FocusCandidateHandlerSuffix) {
 
442
TEST_F(FocusCandidateHandlerTest, FocusCandidateHandlerSuffix) {
429
443
  {
430
444
    Segments segments;
431
445
    Segment *seg[6];