OLD | NEW |
(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 |
OLD | NEW |