| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/font_render_params.h" | 5 #include "ui/gfx/font_render_params.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "ui/gfx/font.h" | 12 #include "ui/gfx/font.h" |
| 13 #include "ui/gfx/linux_font_delegate.h" | 13 #include "ui/gfx/linux_font_delegate.h" |
| 14 #include "ui/gfx/pango_util.h" | 14 #include "ui/gfx/pango_util.h" |
| 15 #include "ui/gfx/test/fontconfig_util_linux.h" | 15 #include "ui/gfx/test/fontconfig_util_linux.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // Implementation of LinuxFontDelegate that returns a canned FontRenderParams | 21 // Implementation of LinuxFontDelegate that returns a canned FontRenderParams |
| 22 // struct. This is used to isolate tests from the system's local configuration. | 22 // struct. This is used to isolate tests from the system's local configuration. |
| 23 class TestFontDelegate : public LinuxFontDelegate { | 23 class TestFontDelegate : public LinuxFontDelegate { |
| 24 public: | 24 public: |
| 25 TestFontDelegate() {} | 25 TestFontDelegate() {} |
| 26 virtual ~TestFontDelegate() {} | 26 virtual ~TestFontDelegate() {} |
| 27 | 27 |
| 28 void set_params(const FontRenderParams& params) { params_ = params; } | 28 void set_params(const FontRenderParams& params) { params_ = params; } |
| 29 | 29 |
| 30 virtual FontRenderParams GetDefaultFontRenderParams() const OVERRIDE { | 30 virtual FontRenderParams GetDefaultFontRenderParams() const override { |
| 31 return params_; | 31 return params_; |
| 32 } | 32 } |
| 33 virtual scoped_ptr<ScopedPangoFontDescription> | 33 virtual scoped_ptr<ScopedPangoFontDescription> |
| 34 GetDefaultPangoFontDescription() const OVERRIDE { | 34 GetDefaultPangoFontDescription() const override { |
| 35 NOTIMPLEMENTED(); | 35 NOTIMPLEMENTED(); |
| 36 return scoped_ptr<ScopedPangoFontDescription>(); | 36 return scoped_ptr<ScopedPangoFontDescription>(); |
| 37 } | 37 } |
| 38 virtual double GetFontDPI() const OVERRIDE { | 38 virtual double GetFontDPI() const override { |
| 39 NOTIMPLEMENTED(); | 39 NOTIMPLEMENTED(); |
| 40 return 96.0; | 40 return 96.0; |
| 41 } | 41 } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 FontRenderParams params_; | 44 FontRenderParams params_; |
| 45 | 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(TestFontDelegate); | 46 DISALLOW_COPY_AND_ASSIGN(TestFontDelegate); |
| 47 }; | 47 }; |
| 48 | 48 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 EXPECT_EQ("Verdana", suggested_family); | 374 EXPECT_EQ("Verdana", suggested_family); |
| 375 | 375 |
| 376 query.families.clear(); | 376 query.families.clear(); |
| 377 query.families.push_back("Arial"); | 377 query.families.push_back("Arial"); |
| 378 suggested_family.clear(); | 378 suggested_family.clear(); |
| 379 GetFontRenderParams(query, &suggested_family); | 379 GetFontRenderParams(query, &suggested_family); |
| 380 EXPECT_EQ("Verdana", suggested_family); | 380 EXPECT_EQ("Verdana", suggested_family); |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace gfx | 383 } // namespace gfx |
| OLD | NEW |