OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/HarfBuzzShaper.h" | 5 #include "platform/fonts/shaping/HarfBuzzShaper.h" |
6 | 6 |
| 7 #include <unicode/uscript.h> |
7 #include "platform/fonts/Font.h" | 8 #include "platform/fonts/Font.h" |
8 #include "platform/fonts/FontCache.h" | 9 #include "platform/fonts/FontCache.h" |
9 #include "platform/fonts/shaping/ShapeResultTestInfo.h" | 10 #include "platform/fonts/shaping/ShapeResultTestInfo.h" |
10 #include "platform/text/TextRun.h" | 11 #include "platform/text/TextRun.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "wtf/Vector.h" | 13 #include "wtf/Vector.h" |
13 #include <unicode/uscript.h> | |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class HarfBuzzShaperTest : public ::testing::Test { | 17 class HarfBuzzShaperTest : public ::testing::Test { |
18 protected: | 18 protected: |
19 void SetUp() override { | 19 void SetUp() override { |
20 fontDescription.setComputedSize(12.0); | 20 fontDescription.setComputedSize(12.0); |
21 font = Font(fontDescription); | 21 font = Font(fontDescription); |
22 font.update(nullptr); | 22 font.update(nullptr); |
23 } | 23 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 RefPtr<ShapeResult> first = shaper.shape(&font, TextDirection::kRtl, 0, 1); | 260 RefPtr<ShapeResult> first = shaper.shape(&font, TextDirection::kRtl, 0, 1); |
261 RefPtr<ShapeResult> second = shaper.shape(&font, TextDirection::kRtl, 1, 2); | 261 RefPtr<ShapeResult> second = shaper.shape(&font, TextDirection::kRtl, 1, 2); |
262 | 262 |
263 // Combined width should be the same when shaping the two characters | 263 // Combined width should be the same when shaping the two characters |
264 // separately as when shaping them combined. | 264 // separately as when shaping them combined. |
265 ASSERT_NEAR(combined->width(), first->width() + second->width(), 0.1); | 265 ASSERT_NEAR(combined->width(), first->width() + second->width(), 0.1); |
266 } | 266 } |
267 | 267 |
268 } // namespace blink | 268 } // namespace blink |
OLD | NEW |