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

Unified Diff: third_party/WebKit/Source/platform/fonts/GenericFontFamilySettingsTest.cpp

Issue 2441343003: Allow the default generic font family settings to find the first available font (Closed)
Patch Set: Add more tests Created 4 years, 2 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/fonts/GenericFontFamilySettingsTest.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/GenericFontFamilySettingsTest.cpp b/third_party/WebKit/Source/platform/fonts/GenericFontFamilySettingsTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8bc8ed2f6208d682a43bb61e6d6effde90b4e4a9
--- /dev/null
+++ b/third_party/WebKit/Source/platform/fonts/GenericFontFamilySettingsTest.cpp
@@ -0,0 +1,28 @@
+// 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/fonts/GenericFontFamilySettings.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+TEST(GenericFontFamilySettingsTest, FirstAvailableFontFamily) {
+ GenericFontFamilySettings settings;
+ EXPECT_TRUE(settings.standard().isEmpty());
+
+ // Returns the first available font if starts with ",".
+ settings.updateStandard(",does not exist, Arial");
+ EXPECT_EQ("Arial", settings.standard());
+
+ // Otherwise returns any strings as they were set.
+ settings.updateStandard("Arial");
+ EXPECT_EQ("Arial", settings.standard());
+ settings.updateStandard("does not exist");
+ EXPECT_EQ("does not exist", settings.standard());
+ settings.updateStandard("does not exist, Arial");
+ EXPECT_EQ("does not exist, Arial", settings.standard());
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698