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

Side by Side Diff: third_party/WebKit/Source/platform/text/HyphenationTest.cpp

Issue 1917423002: Add Hyphenation class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix Created 4 years, 7 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "platform/text/Hyphenation.h"
6
7 #include "platform/Logging.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace blink {
11
12 class NoHyphenation : public Hyphenation {
13 public:
14 size_t lastHyphenLocation(const StringView&, size_t beforeIndex, const Atomi cString& locale) const override
15 {
16 return 0;
17 }
18 };
19
20 TEST(HyphenationTest, GetHyphenation)
21 {
22 RefPtr<Hyphenation> hyphenation = adoptRef(new NoHyphenation);
23 Hyphenation::setForTesting("en-US", hyphenation);
24 EXPECT_EQ(hyphenation.get(), Hyphenation::get("en-US"));
25
26 Hyphenation::setForTesting("en-UK", nullptr);
27 EXPECT_EQ(nullptr, Hyphenation::get("en-UK"));
28
29 Hyphenation::clearForTesting();
30 }
31
32 TEST(HyphenationTest, GetHyphenationCaseFolding)
33 {
34 RefPtr<Hyphenation> hyphenation = adoptRef(new NoHyphenation);
35 Hyphenation::setForTesting("en-US", hyphenation);
36 EXPECT_EQ(hyphenation, Hyphenation::get("en-US"));
37 EXPECT_EQ(hyphenation, Hyphenation::get("en-us"));
38
39 Hyphenation::clearForTesting();
40 }
41
42 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698