OLD | NEW |
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_win.h" | 5 #include "ui/gfx/platform_font_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/gfx/font.h" | 10 #include "ui/gfx/font.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 static_cast<PlatformFontWin*>(base_font.platform_font()); | 85 static_cast<PlatformFontWin*>(base_font.platform_font()); |
86 | 86 |
87 const Font derived_font = | 87 const Font derived_font = |
88 platform_font->DeriveFontWithHeight(min_font.GetHeight() - 1, 0); | 88 platform_font->DeriveFontWithHeight(min_font.GetHeight() - 1, 0); |
89 EXPECT_EQ(min_font.GetFontSize(), derived_font.GetFontSize()); | 89 EXPECT_EQ(min_font.GetFontSize(), derived_font.GetFontSize()); |
90 EXPECT_EQ(min_font.GetHeight(), derived_font.GetHeight()); | 90 EXPECT_EQ(min_font.GetHeight(), derived_font.GetHeight()); |
91 | 91 |
92 PlatformFontWin::get_minimum_font_size_callback = old_callback; | 92 PlatformFontWin::get_minimum_font_size_callback = old_callback; |
93 } | 93 } |
94 | 94 |
| 95 TEST(PlatformFontWinTest, DeriveFontWithHeight_TooSmall) { |
| 96 const Font base_font; |
| 97 PlatformFontWin* platform_font = |
| 98 static_cast<PlatformFontWin*>(base_font.platform_font()); |
| 99 |
| 100 const Font derived_font = platform_font->DeriveFontWithHeight(1, 0); |
| 101 EXPECT_GT(derived_font.GetHeight(), 1); |
| 102 } |
| 103 |
95 } // namespace gfx | 104 } // namespace gfx |
OLD | NEW |