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/shaping/RunSegmenter.h" | 5 #include "platform/fonts/shaping/RunSegmenter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include "platform/fonts/OrientationIterator.h" | 8 #include "platform/fonts/OrientationIterator.h" |
9 #include "platform/wtf/Assertions.h" | 9 #include "platform/wtf/Assertions.h" |
10 #include "platform/wtf/Vector.h" | 10 #include "platform/wtf/Vector.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 #define CHECK_RUNS_HORIZONTAL(...) \ | 89 #define CHECK_RUNS_HORIZONTAL(...) \ |
90 DECLARE_RUNSVECTOR(__VA_ARGS__); \ | 90 DECLARE_RUNSVECTOR(__VA_ARGS__); \ |
91 CheckRuns(runs, FontOrientation::Horizontal); | 91 CheckRuns(runs, FontOrientation::Horizontal); |
92 | 92 |
93 TEST_F(RunSegmenterTest, Empty) { | 93 TEST_F(RunSegmenterTest, Empty) { |
94 String empty(emptyString16Bit); | 94 String empty(emptyString16Bit); |
95 RunSegmenter::RunSegmenterRange segmenterRange = { | 95 RunSegmenter::RunSegmenterRange segmenterRange = { |
96 0, 0, USCRIPT_INVALID_CODE, OrientationIterator::OrientationKeep}; | 96 0, 0, USCRIPT_INVALID_CODE, OrientationIterator::OrientationKeep}; |
97 RunSegmenter runSegmenter(empty.characters16(), empty.length(), | 97 RunSegmenter runSegmenter(empty.characters16(), empty.length(), |
98 FontOrientation::VerticalMixed); | 98 FontOrientation::VerticalMixed); |
99 ASSERT(!runSegmenter.consume(&segmenterRange)); | 99 DCHECK(!runSegmenter.consume(&segmenterRange)); |
100 ASSERT_EQ(segmenterRange.start, 0u); | 100 ASSERT_EQ(segmenterRange.start, 0u); |
101 ASSERT_EQ(segmenterRange.end, 0u); | 101 ASSERT_EQ(segmenterRange.end, 0u); |
102 ASSERT_EQ(segmenterRange.script, USCRIPT_INVALID_CODE); | 102 ASSERT_EQ(segmenterRange.script, USCRIPT_INVALID_CODE); |
103 ASSERT_EQ(segmenterRange.renderOrientation, | 103 ASSERT_EQ(segmenterRange.renderOrientation, |
104 OrientationIterator::OrientationKeep); | 104 OrientationIterator::OrientationKeep); |
105 ASSERT_EQ(segmenterRange.fontFallbackPriority, FontFallbackPriority::Text); | 105 ASSERT_EQ(segmenterRange.fontFallbackPriority, FontFallbackPriority::Text); |
106 } | 106 } |
107 | 107 |
108 TEST_F(RunSegmenterTest, LatinPunctuationSideways) { | 108 TEST_F(RunSegmenterTest, LatinPunctuationSideways) { |
109 CHECK_RUNS_MIXED({{"Abc.;?Xyz", USCRIPT_LATIN, | 109 CHECK_RUNS_MIXED({{"Abc.;?Xyz", USCRIPT_LATIN, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 CHECK_RUNS_HORIZONTAL( | 231 CHECK_RUNS_HORIZONTAL( |
232 {{"աբգ", USCRIPT_ARMENIAN, OrientationIterator::OrientationKeep, | 232 {{"աբգ", USCRIPT_ARMENIAN, OrientationIterator::OrientationKeep, |
233 FontFallbackPriority::Text}, | 233 FontFallbackPriority::Text}, |
234 {"αβγ", USCRIPT_GREEK, OrientationIterator::OrientationKeep, | 234 {"αβγ", USCRIPT_GREEK, OrientationIterator::OrientationKeep, |
235 FontFallbackPriority::Text}, | 235 FontFallbackPriority::Text}, |
236 {"ԱԲԳ", USCRIPT_ARMENIAN, OrientationIterator::OrientationKeep, | 236 {"ԱԲԳ", USCRIPT_ARMENIAN, OrientationIterator::OrientationKeep, |
237 FontFallbackPriority::Text}}); | 237 FontFallbackPriority::Text}}); |
238 } | 238 } |
239 | 239 |
240 } // namespace blink | 240 } // namespace blink |
OLD | NEW |