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

Side by Side Diff: chrome/browser/ui/views/harmony/layout_delegate_unittest.cc

Issue 2801583002: Use views::style for buttons, bootstrap ash_typography to do so. (Closed)
Patch Set: rebase for epic ash file move Created 3 years, 8 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/ui/views/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 #include "chrome/browser/ui/views/harmony/chrome_typography.h" 6 #include "chrome/browser/ui/views/harmony/chrome_typography.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/base/default_style.h" 8 #include "ui/base/default_style.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/base/test/material_design_controller_test_api.h" 10 #include "ui/base/test/material_design_controller_test_api.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 const int twelve = gfx::FontList().GetFontSize() - 1; 202 const int twelve = gfx::FontList().GetFontSize() - 1;
203 #else 203 #else
204 const int twelve = gfx::FontList().GetFontSize(); 204 const int twelve = gfx::FontList().GetFontSize();
205 #endif 205 #endif
206 206
207 EXPECT_EQ(twelve, GetFont(CONTEXT_BODY_TEXT_SMALL, kStyle).GetFontSize()); 207 EXPECT_EQ(twelve, GetFont(CONTEXT_BODY_TEXT_SMALL, kStyle).GetFontSize());
208 EXPECT_EQ(twelve, GetFont(views::style::CONTEXT_LABEL, kStyle).GetFontSize()); 208 EXPECT_EQ(twelve, GetFont(views::style::CONTEXT_LABEL, kStyle).GetFontSize());
209 EXPECT_EQ(twelve, 209 EXPECT_EQ(twelve,
210 GetFont(views::style::CONTEXT_TEXTFIELD, kStyle).GetFontSize()); 210 GetFont(views::style::CONTEXT_TEXTFIELD, kStyle).GetFontSize());
211 EXPECT_EQ(twelve, 211 EXPECT_EQ(twelve,
212 GetFont(views::style::CONTEXT_BUTTON, kStyle).GetFontSize()); 212 GetFont(views::style::CONTEXT_DIALOG_BUTTON, kStyle).GetFontSize());
213 213
214 #if defined(OS_MACOSX) 214 #if defined(OS_MACOSX)
215 // We never exposed UI on Mac using these constants so it doesn't matter that 215 // We never exposed UI on Mac using these constants so it doesn't matter that
216 // they are different. They only need to match under Harmony. 216 // they are different. They only need to match under Harmony.
217 EXPECT_EQ(twelve + 9, GetFont(CONTEXT_HEADLINE, kStyle).GetFontSize()); 217 EXPECT_EQ(twelve + 9, GetFont(CONTEXT_HEADLINE, kStyle).GetFontSize());
218 EXPECT_EQ(twelve + 2, 218 EXPECT_EQ(twelve + 2,
219 GetFont(views::style::CONTEXT_DIALOG_TITLE, kStyle).GetFontSize()); 219 GetFont(views::style::CONTEXT_DIALOG_TITLE, kStyle).GetFontSize());
220 EXPECT_EQ(twelve + 2, GetFont(CONTEXT_BODY_TEXT_LARGE, kStyle).GetFontSize()); 220 EXPECT_EQ(twelve + 2, GetFont(CONTEXT_BODY_TEXT_LARGE, kStyle).GetFontSize());
221 EXPECT_EQ(twelve, GetFont(CONTEXT_DEPRECATED_SMALL, kStyle).GetFontSize()); 221 EXPECT_EQ(twelve, GetFont(CONTEXT_DEPRECATED_SMALL, kStyle).GetFontSize());
222 #else 222 #else
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 SCOPED_TRACE(testing::Message() << "Testing index: " << i); 259 SCOPED_TRACE(testing::Message() << "Testing index: " << i);
260 const auto& increase = kExpectedIncreases[i]; 260 const auto& increase = kExpectedIncreases[i];
261 const gfx::FontList& font = views::style::GetFont(increase.context, kStyle); 261 const gfx::FontList& font = views::style::GetFont(increase.context, kStyle);
262 int line_spacing = views::style::GetLineHeight(increase.context, kStyle); 262 int line_spacing = views::style::GetLineHeight(increase.context, kStyle);
263 EXPECT_GE(increase.max, line_spacing - font.GetHeight()); 263 EXPECT_GE(increase.max, line_spacing - font.GetHeight());
264 EXPECT_LE(increase.min, line_spacing - font.GetHeight()); 264 EXPECT_LE(increase.min, line_spacing - font.GetHeight());
265 } 265 }
266 266
267 // Buttons should specify zero line height (i.e. use the font's height) so 267 // Buttons should specify zero line height (i.e. use the font's height) so
268 // buttons have flexibility to configure their own spacing. 268 // buttons have flexibility to configure their own spacing.
269 EXPECT_EQ(0, 269 EXPECT_EQ(0, views::style::GetLineHeight(views::style::CONTEXT_DIALOG_BUTTON,
270 views::style::GetLineHeight(views::style::CONTEXT_BUTTON, kStyle)); 270 kStyle));
271 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698