platform_font_pango_unittest.cc revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
1// Copyright (c) 2012 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 "ui/gfx/platform_font_pango.h" 6 7#include <string> 8 9#include "base/memory/ref_counted.h" 10#include "testing/gtest/include/gtest/gtest.h" 11#include "ui/gfx/pango_util.h" 12 13namespace gfx { 14 15// Test that PlatformFontPango is able to cope with PangoFontDescriptions 16// containing multiple font families. The first family should be preferred. 17TEST(PlatformFontPangoTest, FamilyList) { 18 ScopedPangoFontDescription desc( 19 pango_font_description_from_string("Arial,Times New Roman, 13px")); 20 scoped_refptr<gfx::PlatformFontPango> font( 21 new gfx::PlatformFontPango(desc.get())); 22 EXPECT_EQ("Arial", font->GetFontName()); 23 EXPECT_EQ(13, font->GetFontSize()); 24 25 ScopedPangoFontDescription desc2( 26 pango_font_description_from_string("Times New Roman,Arial, 15px")); 27 scoped_refptr<gfx::PlatformFontPango> font2( 28 new gfx::PlatformFontPango(desc2.get())); 29 EXPECT_EQ("Times New Roman", font2->GetFontName()); 30 EXPECT_EQ(15, font2->GetFontSize()); 31} 32 33} // namespace gfx 34