OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/ime/chromeos/character_composer.h" | 5 #include "ui/base/ime/chromeos/character_composer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/stl_util.h" | |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
15 #include "ui/events/event_constants.h" | 16 #include "ui/events/event_constants.h" |
16 #include "ui/events/event_utils.h" | 17 #include "ui/events/event_utils.h" |
17 #include "ui/events/keycodes/dom/dom_code.h" | 18 #include "ui/events/keycodes/dom/dom_code.h" |
18 #include "ui/events/keycodes/dom/dom_key.h" | 19 #include "ui/events/keycodes/dom/dom_key.h" |
19 #include "ui/events/keycodes/keyboard_code_conversion.h" | 20 #include "ui/events/keycodes/keyboard_code_conversion.h" |
20 #include "ui/events/keycodes/keyboard_codes.h" | 21 #include "ui/events/keycodes/keyboard_codes.h" |
21 | 22 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 uint16_t previous_key = 0; | 243 uint16_t previous_key = 0; |
243 uint16_t size = kCompositions.tree[index++]; | 244 uint16_t size = kCompositions.tree[index++]; |
244 for (uint16_t i = 0; i < size; ++i) { | 245 for (uint16_t i = 0; i < size; ++i) { |
245 // Verify that the subtable is sorted. | 246 // Verify that the subtable is sorted. |
246 uint16_t key = kCompositions.tree[index]; | 247 uint16_t key = kCompositions.tree[index]; |
247 uint16_t value = kCompositions.tree[index + 1]; | 248 uint16_t value = kCompositions.tree[index + 1]; |
248 if (i) | 249 if (i) |
249 EXPECT_LT(previous_key, key) << index; | 250 EXPECT_LT(previous_key, key) << index; |
250 previous_key = key; | 251 previous_key = key; |
251 // Verify that the internal link is valid. | 252 // Verify that the internal link is valid. |
252 const auto it = std::find(subtrees.begin(), subtrees.end(), value); | 253 EXPECT_FALSE(!base::ContainsValue(subtrees, value)) << index; |
sadrul
2017/06/12 02:05:25
EXPECT_TRUE(base::ContainsValue()) instead?
Tripta
2017/06/12 05:07:51
Done.
| |
253 EXPECT_FALSE(subtrees.end() == it) << index; | |
254 index += 2; | 254 index += 2; |
255 } | 255 } |
256 // Check the leaf subtable. | 256 // Check the leaf subtable. |
257 previous_key = 0; | 257 previous_key = 0; |
258 size = kCompositions.tree[index++]; | 258 size = kCompositions.tree[index++]; |
259 for (uint16_t i = 0; i < size; ++i) { | 259 for (uint16_t i = 0; i < size; ++i) { |
260 // Verify that the subtable is sorted. | 260 // Verify that the subtable is sorted. |
261 uint16_t key = kCompositions.tree[index]; | 261 uint16_t key = kCompositions.tree[index]; |
262 if (i) | 262 if (i) |
263 EXPECT_LT(previous_key, key) << index; | 263 EXPECT_LT(previous_key, key) << index; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 ExpectUnicodeKeyFiltered(VKEY_3, DomCode::DIGIT3, EF_NONE, '3'); | 509 ExpectUnicodeKeyFiltered(VKEY_3, DomCode::DIGIT3, EF_NONE, '3'); |
510 ExpectUnicodeKeyFiltered(VKEY_0, DomCode::DIGIT0, EF_NONE, '0'); | 510 ExpectUnicodeKeyFiltered(VKEY_0, DomCode::DIGIT0, EF_NONE, '0'); |
511 ExpectDeadKeyFiltered(kCombiningAcute); | 511 ExpectDeadKeyFiltered(kCombiningAcute); |
512 ExpectUnicodeKeyFiltered(VKEY_4, DomCode::DIGIT4, EF_NONE, '4'); | 512 ExpectUnicodeKeyFiltered(VKEY_4, DomCode::DIGIT4, EF_NONE, '4'); |
513 ExpectUnicodeKeyFiltered(VKEY_2, DomCode::DIGIT2, EF_NONE, '2'); | 513 ExpectUnicodeKeyFiltered(VKEY_2, DomCode::DIGIT2, EF_NONE, '2'); |
514 ExpectUnicodeKeyComposed(VKEY_SPACE, DomCode::SPACE, EF_NONE, ' ', | 514 ExpectUnicodeKeyComposed(VKEY_SPACE, DomCode::SPACE, EF_NONE, ' ', |
515 base::string16(1, 0x3042)); | 515 base::string16(1, 0x3042)); |
516 } | 516 } |
517 | 517 |
518 } // namespace ui | 518 } // namespace ui |
OLD | NEW |