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 { |
(...skipping 11 matching lines...) Expand all Loading... |
22 : limit(theLimit), fontFallbackPriority(theFontFallbackPriority) {} | 22 : limit(theLimit), fontFallbackPriority(theFontFallbackPriority) {} |
23 }; | 23 }; |
24 | 24 |
25 class SymbolsIteratorTest : public testing::Test { | 25 class SymbolsIteratorTest : public testing::Test { |
26 protected: | 26 protected: |
27 void CheckRuns(const Vector<TestRun>& runs) { | 27 void CheckRuns(const Vector<TestRun>& runs) { |
28 String text(emptyString16Bit()); | 28 String text(emptyString16Bit()); |
29 Vector<ExpectedRun> expect; | 29 Vector<ExpectedRun> expect; |
30 for (auto& run : runs) { | 30 for (auto& run : runs) { |
31 text.append(String::fromUTF8(run.text.c_str())); | 31 text.append(String::fromUTF8(run.text.c_str())); |
32 expect.append(ExpectedRun(text.length(), run.fontFallbackPriority)); | 32 expect.push_back(ExpectedRun(text.length(), run.fontFallbackPriority)); |
33 } | 33 } |
34 SymbolsIterator symbolsIterator(text.characters16(), text.length()); | 34 SymbolsIterator symbolsIterator(text.characters16(), text.length()); |
35 VerifyRuns(&symbolsIterator, expect); | 35 VerifyRuns(&symbolsIterator, expect); |
36 } | 36 } |
37 | 37 |
38 void VerifyRuns(SymbolsIterator* symbolsIterator, | 38 void VerifyRuns(SymbolsIterator* symbolsIterator, |
39 const Vector<ExpectedRun>& expect) { | 39 const Vector<ExpectedRun>& expect) { |
40 unsigned limit; | 40 unsigned limit; |
41 FontFallbackPriority fontFallbackPriority; | 41 FontFallbackPriority fontFallbackPriority; |
42 unsigned long runCount = 0; | 42 unsigned long runCount = 0; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 TEST_F(SymbolsIteratorTest, Arrows) { | 206 TEST_F(SymbolsIteratorTest, Arrows) { |
207 CHECK_RUNS({{"x→←x←↑↓→", FontFallbackPriority::Text}}); | 207 CHECK_RUNS({{"x→←x←↑↓→", FontFallbackPriority::Text}}); |
208 } | 208 } |
209 | 209 |
210 TEST_F(SymbolsIteratorTest, JudgePilot) { | 210 TEST_F(SymbolsIteratorTest, JudgePilot) { |
211 CHECK_RUNS({{"👨⚖️👩⚖️👨🏼⚖️👩🏼⚖️", | 211 CHECK_RUNS({{"👨⚖️👩⚖️👨🏼⚖️👩🏼⚖️", |
212 FontFallbackPriority::EmojiEmoji}}); | 212 FontFallbackPriority::EmojiEmoji}}); |
213 } | 213 } |
214 | 214 |
215 } // namespace blink | 215 } // namespace blink |
OLD | NEW |