Add std:: prefix to unittests on Linux
BUG=#392
TEST=unittest
REF_BUG=71969651
REF_CL=182003794
REF_TIME=2018-01-16T12:24:27+09:00
REF_TIME_RAW=1516073067 +0900
Hiroyuki Komatsu
6 years ago
177 | 177 | int g_counter = 0; |
178 | 178 | string DebugString() { |
179 | 179 | ++g_counter; |
180 | ostringstream os; | |
180 | std::ostringstream os; | |
181 | 181 | os << g_counter << " test!"; |
182 | 182 | return os.str(); |
183 | 183 | } |
29 | 29 | |
30 | 30 | MAJOR=2 |
31 | 31 | MINOR=23 |
32 | BUILD=2790 | |
32 | BUILD=2791 | |
33 | 33 | REVISION=102 |
34 | 34 | # This version represents the version of Mozc IME engine (converter, predictor, |
35 | 35 | # etc.). This version info is included both in the Mozc server and in the Mozc |
1024 | 1024 | Rect original_footer_content_area(100, 200, 300, 400); |
1025 | 1025 | const int focused_index = 3; |
1026 | 1026 | const int total_items = 7; |
1027 | stringstream footer_string; | |
1027 | std::stringstream footer_string; | |
1028 | 1028 | footer_string << focused_index + 1 << "/" << total_items << " "; |
1029 | 1029 | const string index_guide_string = footer_string.str(); |
1030 | 1030 | const Size index_guide_size(10, 20); |
1218 | 1218 | const string expected_value = GetExpectedValue(i, true, true); |
1219 | 1219 | |
1220 | 1220 | // Shortcut string is padded with one spacing character. |
1221 | stringstream shortcut_stream; | |
1221 | std::stringstream shortcut_stream; | |
1222 | 1222 | shortcut_stream << " " << GetExpectedShortcut(i) << " "; |
1223 | 1223 | |
1224 | 1224 | const string expected_shortcut = shortcut_stream.str(); |
1258 | 1258 | const string expected_value = GetExpectedValue(i, true, true); |
1259 | 1259 | |
1260 | 1260 | // Description string is end-padded with one spacing character. |
1261 | stringstream description_stream; | |
1261 | std::stringstream description_stream; | |
1262 | 1262 | description_stream << GetExpectedDescription(i) << " "; |
1263 | 1263 | |
1264 | 1264 | const string expected_description = description_stream.str(); |
1298 | 1298 | const string expected_value = GetExpectedValue(i, true, true); |
1299 | 1299 | |
1300 | 1300 | // Shortcut string is padded with one spacing character. |
1301 | stringstream shortcut_stream; | |
1301 | std::stringstream shortcut_stream; | |
1302 | 1302 | shortcut_stream << " " << GetExpectedShortcut(i) << " "; |
1303 | 1303 | const string expected_shortcut = shortcut_stream.str(); |
1304 | 1304 | |
1305 | 1305 | // Description string is end-padded with one spacing character. |
1306 | stringstream description_stream; | |
1306 | std::stringstream description_stream; | |
1307 | 1307 | description_stream << GetExpectedDescription(i) << " "; |
1308 | 1308 | const string expected_description = description_stream.str(); |
1309 | 1309 |
60 | 60 | |
61 | 61 | // Currently this function does not supports special keys. |
62 | 62 | void AppendToKeyEvent(guint keyval, commands::KeyEvent *key) const { |
63 | const map<guint, commands::KeyEvent::ModifierKey>::const_iterator it = | |
63 | const std::map<guint, commands::KeyEvent::ModifierKey>::const_iterator it = | |
64 | 64 | keyval_to_modifier_.find(keyval); |
65 | 65 | if (it != keyval_to_modifier_.end()) { |
66 | 66 | bool found = false; |
90 | 90 | } |
91 | 91 | |
92 | 92 | bool IsPressed(guint keyval) const { |
93 | const set<guint> &pressed_set = handler_->currently_pressed_modifiers_; | |
93 | const std::set<guint> &pressed_set = handler_->currently_pressed_modifiers_; | |
94 | 94 | return pressed_set.find(keyval) != pressed_set.end(); |
95 | 95 | } |
96 | 96 | |
98 | 98 | return handler_->is_non_modifier_key_pressed_; |
99 | 99 | } |
100 | 100 | |
101 | const set<guint> ¤tly_pressed_modifiers() { | |
101 | const std::set<guint> ¤tly_pressed_modifiers() { | |
102 | 102 | return handler_->currently_pressed_modifiers_; |
103 | 103 | } |
104 | 104 | |
105 | const set<commands::KeyEvent::ModifierKey> &modifiers_to_be_sent() { | |
105 | const std::set<commands::KeyEvent::ModifierKey> &modifiers_to_be_sent() { | |
106 | 106 | return handler_->modifiers_to_be_sent_; |
107 | 107 | } |
108 | 108 | |
109 | 109 | testing::AssertionResult CheckModifiersToBeSent(uint32 modifiers) { |
110 | 110 | uint32 to_be_sent_mask = 0; |
111 | for (set<commands::KeyEvent::ModifierKey>::iterator it = | |
111 | for (std::set<commands::KeyEvent::ModifierKey>::iterator it = | |
112 | 112 | modifiers_to_be_sent().begin(); |
113 | 113 | it != modifiers_to_be_sent().end(); ++it) { |
114 | 114 | to_be_sent_mask |= *it; |
135 | 135 | } |
136 | 136 | |
137 | 137 | unique_ptr<KeyEventHandler> handler_; |
138 | map<guint, commands::KeyEvent::ModifierKey> keyval_to_modifier_; | |
138 | std::map<guint, commands::KeyEvent::ModifierKey> keyval_to_modifier_; | |
139 | 139 | }; |
140 | 140 | |
141 | 141 | #define EXPECT_MODIFIERS_TO_BE_SENT(modifiers) \ |
431 | 431 | for (int trial = 0; trial < kTrialNum; ++trial) { |
432 | 432 | handler_->Clear(); |
433 | 433 | |
434 | set<guint> pressed_keys; | |
434 | std::set<guint> pressed_keys; | |
435 | 435 | string key_sequence; |
436 | 436 | |
437 | 437 | const int kSequenceLength = 100; |
452 | 452 | is_key_up, key_index); |
453 | 453 | |
454 | 454 | commands::KeyEvent key; |
455 | for (set<guint>::const_iterator it = pressed_keys.begin(); | |
455 | for (std::set<guint>::const_iterator it = pressed_keys.begin(); | |
456 | 456 | it != pressed_keys.end(); ++it) { |
457 | 457 | AppendToKeyEvent(*it, &key); |
458 | 458 | } |
37 | 37 | |
38 | 38 | TEST(SurroundingTextUtilTest, GetSafeDelta) { |
39 | 39 | const guint kSafeInt32MaxAsGUint = |
40 | static_cast<guint>(numeric_limits<int32>::max()); | |
40 | static_cast<guint>(std::numeric_limits<int32>::max()); | |
41 | 41 | const guint kTooLargeGUint = kSafeInt32MaxAsGUint + 42; |
42 | 42 | |
43 | 43 | int32 delta = 0; |
80 | 80 | |
81 | 81 | // The abs(result) exceeds int32. |
82 | 82 | EXPECT_FALSE(SurroundingTextUtil::GetSafeDelta( |
83 | static_cast<guint>(-numeric_limits<int32>::min()), | |
83 | static_cast<guint>(-std::numeric_limits<int32>::min()), | |
84 | 84 | 0, &delta)); |
85 | 85 | } |
86 | 86 |