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

Side by Side Diff: ui/gfx/platform_font_linux_unittest.cc

Issue 2760463003: Reset Default Font on exit from PlatformFontLinuxTest. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/platform_font_linux.h" 5 #include "ui/gfx/platform_font_linux.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 public: 63 public:
64 PlatformFontLinuxTest() { 64 PlatformFontLinuxTest() {
65 SetUpFontconfig(); 65 SetUpFontconfig();
66 original_font_delegate_ = LinuxFontDelegate::instance(); 66 original_font_delegate_ = LinuxFontDelegate::instance();
67 LinuxFontDelegate::SetInstance(&test_font_delegate_); 67 LinuxFontDelegate::SetInstance(&test_font_delegate_);
68 } 68 }
69 69
70 ~PlatformFontLinuxTest() override { 70 ~PlatformFontLinuxTest() override {
71 LinuxFontDelegate::SetInstance( 71 LinuxFontDelegate::SetInstance(
72 const_cast<LinuxFontDelegate*>(original_font_delegate_)); 72 const_cast<LinuxFontDelegate*>(original_font_delegate_));
73 PlatformFontLinux::ReloadDefaultFont();
73 TearDownFontconfig(); 74 TearDownFontconfig();
74 } 75 }
75 76
76 protected: 77 protected:
77 TestFontDelegate test_font_delegate_; 78 TestFontDelegate test_font_delegate_;
78 79
79 private: 80 private:
80 // Originally-registered delegate. 81 // Originally-registered delegate.
81 const LinuxFontDelegate* original_font_delegate_; 82 const LinuxFontDelegate* original_font_delegate_;
82 83
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 #endif 123 #endif
123 PlatformFontLinux::ReloadDefaultFont(); 124 PlatformFontLinux::ReloadDefaultFont();
124 scoped_refptr<gfx::PlatformFontLinux> font2(new gfx::PlatformFontLinux()); 125 scoped_refptr<gfx::PlatformFontLinux> font2(new gfx::PlatformFontLinux());
125 EXPECT_EQ("Times New Roman", font2->GetFontName()); 126 EXPECT_EQ("Times New Roman", font2->GetFontName());
126 EXPECT_EQ(15, font2->GetFontSize()); 127 EXPECT_EQ(15, font2->GetFontSize());
127 EXPECT_NE(font2->GetStyle() & Font::ITALIC, 0); 128 EXPECT_NE(font2->GetStyle() & Font::ITALIC, 0);
128 EXPECT_EQ(gfx::Font::Weight::BOLD, font2->GetWeight()); 129 EXPECT_EQ(gfx::Font::Weight::BOLD, font2->GetWeight());
129 } 130 }
130 131
131 } // namespace gfx 132 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698