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 22 matching lines...) Expand all Loading... |
33 UScriptCode the_script, | 33 UScriptCode the_script, |
34 OrientationIterator::RenderOrientation the_render_orientation, | 34 OrientationIterator::RenderOrientation the_render_orientation, |
35 FontFallbackPriority the_font_fallback_priority) | 35 FontFallbackPriority the_font_fallback_priority) |
36 : start(the_start), | 36 : start(the_start), |
37 limit(the_limit), | 37 limit(the_limit), |
38 script(the_script), | 38 script(the_script), |
39 render_orientation(the_render_orientation), | 39 render_orientation(the_render_orientation), |
40 font_fallback_priority(the_font_fallback_priority) {} | 40 font_fallback_priority(the_font_fallback_priority) {} |
41 }; | 41 }; |
42 | 42 |
43 class RunSegmenterTest : public testing::Test { | 43 class RunSegmenterTest : public ::testing::Test { |
44 protected: | 44 protected: |
45 void CheckRuns(const Vector<SegmenterTestRun>& runs, | 45 void CheckRuns(const Vector<SegmenterTestRun>& runs, |
46 FontOrientation orientation) { | 46 FontOrientation orientation) { |
47 String text(g_empty_string16_bit); | 47 String text(g_empty_string16_bit); |
48 Vector<SegmenterExpectedRun> expect; | 48 Vector<SegmenterExpectedRun> expect; |
49 for (auto& run : runs) { | 49 for (auto& run : runs) { |
50 unsigned length_before = text.length(); | 50 unsigned length_before = text.length(); |
51 text.append(String::FromUTF8(run.text.c_str())); | 51 text.append(String::FromUTF8(run.text.c_str())); |
52 expect.push_back(SegmenterExpectedRun(length_before, text.length(), | 52 expect.push_back(SegmenterExpectedRun(length_before, text.length(), |
53 run.script, run.render_orientation, | 53 run.script, run.render_orientation, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 CHECK_RUNS_HORIZONTAL( | 234 CHECK_RUNS_HORIZONTAL( |
235 {{"աբգ", USCRIPT_ARMENIAN, OrientationIterator::kOrientationKeep, | 235 {{"աբգ", USCRIPT_ARMENIAN, OrientationIterator::kOrientationKeep, |
236 FontFallbackPriority::kText}, | 236 FontFallbackPriority::kText}, |
237 {"αβγ", USCRIPT_GREEK, OrientationIterator::kOrientationKeep, | 237 {"αβγ", USCRIPT_GREEK, OrientationIterator::kOrientationKeep, |
238 FontFallbackPriority::kText}, | 238 FontFallbackPriority::kText}, |
239 {"ԱԲԳ", USCRIPT_ARMENIAN, OrientationIterator::kOrientationKeep, | 239 {"ԱԲԳ", USCRIPT_ARMENIAN, OrientationIterator::kOrientationKeep, |
240 FontFallbackPriority::kText}}); | 240 FontFallbackPriority::kText}}); |
241 } | 241 } |
242 | 242 |
243 } // namespace blink | 243 } // namespace blink |
OLD | NEW |