summaryrefslogtreecommitdiffstats
path: root/ui/gfx/platform_font_pango_unittest.cc
blob: 6f1571e56587b234d39ef6015c54ac91e00aa3ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2012 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 "ui/gfx/platform_font_pango.h"

#include <string>

#include "base/memory/ref_counted.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/pango_util.h"

namespace gfx {

// Fails on Chrome OS: http://crbug.com/124451
#if defined(OS_CHROMEOS)
#define MAYBE_FamilyList FAILS_FamilyList
#else
#define MAYBE_FamilyList FamilyList
#endif

// Test that PlatformFontPango is able to cope with PangoFontDescriptions
// containing multiple font families.  The first family should be preferred.
TEST(PlatformFontPangoTest, MAYBE_FamilyList) {
  ScopedPangoFontDescription desc(
      pango_font_description_from_string("Arial,Times New Roman, 13px"));
  scoped_refptr<gfx::PlatformFontPango> font(
      new gfx::PlatformFontPango(desc.get()));
  EXPECT_EQ("Arial", font->GetFontName());
  EXPECT_EQ(13, font->GetFontSize());

  ScopedPangoFontDescription desc2(
      pango_font_description_from_string("Times New Roman,Arial, 15px"));
  scoped_refptr<gfx::PlatformFontPango> font2(
      new gfx::PlatformFontPango(desc2.get()));
  EXPECT_EQ("Times New Roman", font2->GetFontName());
  EXPECT_EQ(15, font2->GetFontSize());
}

}  // namespace gfx