OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/fonts/SymbolsIterator.h" | 5 #include "platform/fonts/SymbolsIterator.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 struct TestRun { | 12 struct TestRun { |
13 std::string text; | 13 std::string text; |
14 FontFallbackPriority font_fallback_priority; | 14 FontFallbackPriority font_fallback_priority; |
15 }; | 15 }; |
16 | 16 |
17 struct ExpectedRun { | 17 struct ExpectedRun { |
18 unsigned limit; | 18 unsigned limit; |
19 FontFallbackPriority font_fallback_priority; | 19 FontFallbackPriority font_fallback_priority; |
20 | 20 |
21 ExpectedRun(unsigned the_limit, | 21 ExpectedRun(unsigned the_limit, |
22 FontFallbackPriority the_font_fallback_priority) | 22 FontFallbackPriority the_font_fallback_priority) |
23 : limit(the_limit), font_fallback_priority(the_font_fallback_priority) {} | 23 : limit(the_limit), font_fallback_priority(the_font_fallback_priority) {} |
24 }; | 24 }; |
25 | 25 |
26 class SymbolsIteratorTest : public testing::Test { | 26 class SymbolsIteratorTest : public ::testing::Test { |
27 protected: | 27 protected: |
28 void CheckRuns(const Vector<TestRun>& runs) { | 28 void CheckRuns(const Vector<TestRun>& runs) { |
29 String text(g_empty_string16_bit); | 29 String text(g_empty_string16_bit); |
30 Vector<ExpectedRun> expect; | 30 Vector<ExpectedRun> expect; |
31 for (auto& run : runs) { | 31 for (auto& run : runs) { |
32 text.append(String::FromUTF8(run.text.c_str())); | 32 text.append(String::FromUTF8(run.text.c_str())); |
33 expect.push_back(ExpectedRun(text.length(), run.font_fallback_priority)); | 33 expect.push_back(ExpectedRun(text.length(), run.font_fallback_priority)); |
34 } | 34 } |
35 SymbolsIterator symbols_iterator(text.Characters16(), text.length()); | 35 SymbolsIterator symbols_iterator(text.Characters16(), text.length()); |
36 VerifyRuns(&symbols_iterator, expect); | 36 VerifyRuns(&symbols_iterator, expect); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 "\xF0\x9F\xA7\xA2\xF0\x9F\xA6\x93\xF0\x9F\xA6\x92\xF0\x9F\xA6\x94\xF0" | 361 "\xF0\x9F\xA7\xA2\xF0\x9F\xA6\x93\xF0\x9F\xA6\x92\xF0\x9F\xA6\x94\xF0" |
362 "\x9F\xA6\x95\xF0\x9F\xA6\x96\xF0\x9F\xA6\x97\xF0\x9F\xA5\xA5\xF0\x9F" | 362 "\x9F\xA6\x95\xF0\x9F\xA6\x96\xF0\x9F\xA6\x97\xF0\x9F\xA5\xA5\xF0\x9F" |
363 "\xA5\xA6\xF0\x9F\xA5\xA8\xF0\x9F\xA5\xA9\xF0\x9F\xA5\xAA\xF0\x9F\xA5" | 363 "\xA5\xA6\xF0\x9F\xA5\xA8\xF0\x9F\xA5\xA9\xF0\x9F\xA5\xAA\xF0\x9F\xA5" |
364 "\xA3\xF0\x9F\xA5\xAB\xF0\x9F\xA5\x9F\xF0\x9F\xA5\xA0\xF0\x9F\xA5\xA1" | 364 "\xA3\xF0\x9F\xA5\xAB\xF0\x9F\xA5\x9F\xF0\x9F\xA5\xA0\xF0\x9F\xA5\xA1" |
365 "\xF0\x9F\xA5\xA7\xF0\x9F\xA5\xA4\xF0\x9F\xA5\xA2\xF0\x9F\x9B\xB8\xF0" | 365 "\xF0\x9F\xA5\xA7\xF0\x9F\xA5\xA4\xF0\x9F\xA5\xA2\xF0\x9F\x9B\xB8\xF0" |
366 "\x9F\x9B\xB7\xF0\x9F\xA5\x8C", | 366 "\x9F\x9B\xB7\xF0\x9F\xA5\x8C", |
367 FontFallbackPriority::kEmojiEmoji}}); | 367 FontFallbackPriority::kEmojiEmoji}}); |
368 } | 368 } |
369 | 369 |
370 } // namespace blink | 370 } // namespace blink |
OLD | NEW |