| 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 "platform/Logging.h" | 7 #include "platform/Logging.h" |
| 8 #include "platform/fonts/OrientationIterator.h" | 8 #include "platform/fonts/OrientationIterator.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 , script(theScript) | 42 , script(theScript) |
| 43 , renderOrientation(theRenderOrientation) | 43 , renderOrientation(theRenderOrientation) |
| 44 , smallCapsBehavior(theSmallCapsBehavior) | 44 , smallCapsBehavior(theSmallCapsBehavior) |
| 45 , fontFallbackPriority(theFontFallbackPriority) | 45 , fontFallbackPriority(theFontFallbackPriority) |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class RunSegmenterTest : public testing::Test { | 50 class RunSegmenterTest : public testing::Test { |
| 51 protected: | 51 protected: |
| 52 #if !LOG_DISABLED | |
| 53 static void SetUpTestCase() | |
| 54 { | |
| 55 LogFonts = { WTFLogChannelOn }; | |
| 56 } | |
| 57 #endif | |
| 58 | |
| 59 void CheckRuns(const Vector<SegmenterTestRun>& runs, FontOrientation orienta
tion, FontVariant variant) | 52 void CheckRuns(const Vector<SegmenterTestRun>& runs, FontOrientation orienta
tion, FontVariant variant) |
| 60 { | 53 { |
| 61 String text(emptyString16Bit()); | 54 String text(emptyString16Bit()); |
| 62 Vector<SegmenterExpectedRun> expect; | 55 Vector<SegmenterExpectedRun> expect; |
| 63 for (auto& run : runs) { | 56 for (auto& run : runs) { |
| 64 unsigned lengthBefore = text.length(); | 57 unsigned lengthBefore = text.length(); |
| 65 text.append(String::fromUTF8(run.text.c_str())); | 58 text.append(String::fromUTF8(run.text.c_str())); |
| 66 expect.append(SegmenterExpectedRun(lengthBefore, text.length(), run.
script, run.renderOrientation, run.smallCapsBehavior, run.fontFallbackPriority))
; | 59 expect.append(SegmenterExpectedRun(lengthBefore, text.length(), run.
script, run.renderOrientation, run.smallCapsBehavior, run.fontFallbackPriority))
; |
| 67 } | 60 } |
| 68 RunSegmenter runSegmenter(text.characters16(), text.length(), orientatio
n, variant); | 61 RunSegmenter runSegmenter(text.characters16(), text.length(), orientatio
n, variant); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 TEST_F(RunSegmenterTest, ArmenianCyrillicSmallCaps) | 212 TEST_F(RunSegmenterTest, ArmenianCyrillicSmallCaps) |
| 220 { | 213 { |
| 221 CHECK_RUNS_HORIZONTAL_SMALLCAPS({ { "աբգ", USCRIPT_ARMENIAN, OrientationIter
ator::OrientationKeep, SmallCapsIterator::SmallCapsUppercaseNeeded, FontFallback
Priority::Text }, | 214 CHECK_RUNS_HORIZONTAL_SMALLCAPS({ { "աբգ", USCRIPT_ARMENIAN, OrientationIter
ator::OrientationKeep, SmallCapsIterator::SmallCapsUppercaseNeeded, FontFallback
Priority::Text }, |
| 222 { "αβγ", USCRIPT_GREEK, OrientationIterator::OrientationKeep, SmallCapsI
terator::SmallCapsUppercaseNeeded, FontFallbackPriority::Text }, | 215 { "αβγ", USCRIPT_GREEK, OrientationIterator::OrientationKeep, SmallCapsI
terator::SmallCapsUppercaseNeeded, FontFallbackPriority::Text }, |
| 223 { "ԱԲԳ", USCRIPT_ARMENIAN, OrientationIterator::OrientationKeep, SmallCa
psIterator::SmallCapsSameCase, FontFallbackPriority::Text } }); | 216 { "ԱԲԳ", USCRIPT_ARMENIAN, OrientationIterator::OrientationKeep, SmallCa
psIterator::SmallCapsSameCase, FontFallbackPriority::Text } }); |
| 224 } | 217 } |
| 225 | 218 |
| 226 | 219 |
| 227 | 220 |
| 228 } // namespace blink | 221 } // namespace blink |
| OLD | NEW |