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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698