| Index: third_party/WebKit/Source/platform/text/HyphenationTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/text/HyphenationTest.cpp b/third_party/WebKit/Source/platform/text/HyphenationTest.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a209e1a89dfc312c8981f791f0a251c070a3a09b
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/platform/text/HyphenationTest.cpp
|
| @@ -0,0 +1,42 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "platform/text/Hyphenation.h"
|
| +
|
| +#include "platform/Logging.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class NoHyphenation : public Hyphenation {
|
| +public:
|
| + size_t lastHyphenLocation(const StringView&, size_t beforeIndex, const AtomicString& locale) const override
|
| + {
|
| + return 0;
|
| + }
|
| +};
|
| +
|
| +TEST(HyphenationTest, GetHyphenation)
|
| +{
|
| + RefPtr<Hyphenation> hyphenation = adoptRef(new NoHyphenation);
|
| + Hyphenation::setForTesting("en-US", hyphenation);
|
| + EXPECT_EQ(hyphenation.get(), Hyphenation::get("en-US"));
|
| +
|
| + Hyphenation::setForTesting("en-UK", nullptr);
|
| + EXPECT_EQ(nullptr, Hyphenation::get("en-UK"));
|
| +
|
| + Hyphenation::clearForTesting();
|
| +}
|
| +
|
| +TEST(HyphenationTest, GetHyphenationCaseFolding)
|
| +{
|
| + RefPtr<Hyphenation> hyphenation = adoptRef(new NoHyphenation);
|
| + Hyphenation::setForTesting("en-US", hyphenation);
|
| + EXPECT_EQ(hyphenation, Hyphenation::get("en-US"));
|
| + EXPECT_EQ(hyphenation, Hyphenation::get("en-us"));
|
| +
|
| + Hyphenation::clearForTesting();
|
| +}
|
| +
|
| +} // namespace blink
|
|
|