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

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

Issue 2161683002: Add LayoutLocale class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test stability Created 4 years, 4 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 (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/CachingWordShaper.h" 5 #include "platform/fonts/shaping/CachingWordShaper.h"
6 6
7 #include "platform/fonts/CharacterRange.h" 7 #include "platform/fonts/CharacterRange.h"
8 #include "platform/fonts/FontCache.h" 8 #include "platform/fonts/FontCache.h"
9 #include "platform/fonts/GlyphBuffer.h" 9 #include "platform/fonts/GlyphBuffer.h"
10 #include "platform/fonts/shaping/CachingWordShapeIterator.h" 10 #include "platform/fonts/shaping/CachingWordShapeIterator.h"
11 #include "platform/fonts/shaping/ShapeResultTestInfo.h" 11 #include "platform/fonts/shaping/ShapeResultTestInfo.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "wtf/PtrUtil.h" 13 #include "wtf/PtrUtil.h"
14 #include <memory> 14 #include <memory>
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class CachingWordShaperTest : public ::testing::Test { 18 class CachingWordShaperTest : public ::testing::Test {
19 protected: 19 protected:
20 void SetUp() override 20 void SetUp() override
21 { 21 {
22 fontDescription.setComputedSize(12.0); 22 fontDescription.setComputedSize(12.0);
23 fontDescription.setLocale("en"); 23 fontDescription.setLocale(LayoutLocale::get("en"));
24 ASSERT_EQ(USCRIPT_LATIN, fontDescription.script()); 24 ASSERT_EQ(USCRIPT_LATIN, fontDescription.script());
25 fontDescription.setGenericFamily(FontDescription::StandardFamily); 25 fontDescription.setGenericFamily(FontDescription::StandardFamily);
26 26
27 font = Font(fontDescription); 27 font = Font(fontDescription);
28 font.update(nullptr); 28 font.update(nullptr);
29 ASSERT_TRUE(font.canShapeWordByWord()); 29 ASSERT_TRUE(font.canShapeWordByWord());
30 fallbackFonts = nullptr; 30 fallbackFonts = nullptr;
31 cache = wrapUnique(new ShapeCache()); 31 cache = wrapUnique(new ShapeCache());
32 } 32 }
33 33
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 float periodsAndSpacesWidth = shaper.width(&font, periodsAndSpaces, nullptr, &periodsAndSpacesGlyphBounds); 520 float periodsAndSpacesWidth = shaper.width(&font, periodsAndSpaces, nullptr, &periodsAndSpacesGlyphBounds);
521 521
522 // The total width of periods and spaces should be longer than the width of periods alone. 522 // The total width of periods and spaces should be longer than the width of periods alone.
523 ASSERT_GT(periodsAndSpacesWidth, periodsWidth); 523 ASSERT_GT(periodsAndSpacesWidth, periodsWidth);
524 524
525 // The glyph bounds of periods and spaces should be longer than the glyph bo unds of periods alone. 525 // The glyph bounds of periods and spaces should be longer than the glyph bo unds of periods alone.
526 ASSERT_GT(periodsAndSpacesGlyphBounds.width(), periodsGlyphBounds.width()); 526 ASSERT_GT(periodsAndSpacesGlyphBounds.width(), periodsGlyphBounds.width());
527 } 527 }
528 528
529 } // namespace blink 529 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698