gpu: Tweak Android WebGL test expectations
[chromium-blink-merge.git] / ui / gfx / platform_font_pango_unittest.cc
blob228c66b0201e167a82d66f672c7dfbfa5f5be787
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.
5 #include "ui/gfx/platform_font_pango.h"
7 #include <cairo/cairo.h>
8 #include <fontconfig/fontconfig.h>
9 #include <glib-object.h>
10 #include <pango/pangocairo.h>
11 #include <pango/pangofc-fontmap.h>
13 #include <string>
15 #include "base/memory/ref_counted.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/gfx/pango_util.h"
19 namespace gfx {
21 // Test that PlatformFontPango is able to cope with PangoFontDescriptions
22 // containing multiple font families. The first family should be preferred.
23 TEST(PlatformFontPangoTest, FamilyList) {
24 // Needed for GLib versions prior to 2.36.
25 g_type_init();
27 ScopedPangoFontDescription desc(
28 pango_font_description_from_string("Arial,Times New Roman, 13px"));
29 scoped_refptr<gfx::PlatformFontPango> font(
30 new gfx::PlatformFontPango(desc.get()));
31 EXPECT_EQ("Arial", font->GetFontName());
32 EXPECT_EQ(13, font->GetFontSize());
34 ScopedPangoFontDescription desc2(
35 pango_font_description_from_string("Times New Roman,Arial, 15px"));
36 scoped_refptr<gfx::PlatformFontPango> font2(
37 new gfx::PlatformFontPango(desc2.get()));
38 EXPECT_EQ("Times New Roman", font2->GetFontName());
39 EXPECT_EQ(15, font2->GetFontSize());
41 // Free memory allocated by FontConfig (http://crbug.com/114750).
42 pango_fc_font_map_cache_clear(
43 PANGO_FC_FONT_MAP(pango_cairo_font_map_get_default()));
44 cairo_debug_reset_static_data();
45 FcFini();
48 } // namespace gfx