Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/RunSegmenterTest.cpp

Issue 2615813003: Migrate WTF::Vector::append() to ::push_back() [part 14 of N] (Closed)
Patch Set: rebase, small fix in FontSettings.h Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "platform/fonts/OrientationIterator.h" 7 #include "platform/fonts/OrientationIterator.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "wtf/Assertions.h" 9 #include "wtf/Assertions.h"
10 #include "wtf/Vector.h" 10 #include "wtf/Vector.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(emptyString16Bit()); 47 String text(emptyString16Bit());
48 Vector<SegmenterExpectedRun> expect; 48 Vector<SegmenterExpectedRun> expect;
49 for (auto& run : runs) { 49 for (auto& run : runs) {
50 unsigned lengthBefore = text.length(); 50 unsigned lengthBefore = text.length();
51 text.append(String::fromUTF8(run.text.c_str())); 51 text.append(String::fromUTF8(run.text.c_str()));
52 expect.append(SegmenterExpectedRun(lengthBefore, text.length(), 52 expect.push_back(SegmenterExpectedRun(lengthBefore, text.length(),
53 run.script, run.renderOrientation, 53 run.script, run.renderOrientation,
54 run.fontFallbackPriority)); 54 run.fontFallbackPriority));
55 } 55 }
56 RunSegmenter runSegmenter(text.characters16(), text.length(), orientation); 56 RunSegmenter runSegmenter(text.characters16(), text.length(), orientation);
57 VerifyRuns(&runSegmenter, expect); 57 VerifyRuns(&runSegmenter, expect);
58 } 58 }
59 59
60 void VerifyRuns(RunSegmenter* runSegmenter, 60 void VerifyRuns(RunSegmenter* runSegmenter,
61 const Vector<SegmenterExpectedRun>& expect) { 61 const Vector<SegmenterExpectedRun>& expect) {
62 RunSegmenter::RunSegmenterRange segmenterRange; 62 RunSegmenter::RunSegmenterRange segmenterRange;
63 unsigned long runCount = 0; 63 unsigned long runCount = 0;
64 while (runSegmenter->consume(&segmenterRange)) { 64 while (runSegmenter->consume(&segmenterRange)) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698