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

Unified Diff: ui/base/cocoa/menu_controller_unittest.mm

Issue 117903006: Refactor: Makes menus use gfx::FontList instead of gfx::Font. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/cocoa/menu_controller_unittest.mm
diff --git a/ui/base/cocoa/menu_controller_unittest.mm b/ui/base/cocoa/menu_controller_unittest.mm
index 9e54ee84fabc3f535ed3d48e7b7b35723aa6b4ad..119685dd9b2e5de3bfc7c78fc5f53b985b04c34b 100644
--- a/ui/base/cocoa/menu_controller_unittest.mm
+++ b/ui/base/cocoa/menu_controller_unittest.mm
@@ -110,22 +110,23 @@ class DynamicDelegate : public Delegate {
gfx::Image icon_;
};
-// Menu model that returns a gfx::Font object for one of the items in the menu.
-class FontMenuModel : public SimpleMenuModel {
+// Menu model that returns a gfx::FontList object for one of the items in the
+// menu.
+class FontListMenuModel : public SimpleMenuModel {
public:
- FontMenuModel(SimpleMenuModel::Delegate* delegate,
- const gfx::Font* font, int index)
+ FontListMenuModel(SimpleMenuModel::Delegate* delegate,
+ const gfx::FontList* font_list, int index)
: SimpleMenuModel(delegate),
- font_(font),
+ font_list_(font_list),
index_(index) {
}
- virtual ~FontMenuModel() {}
- virtual const gfx::Font* GetLabelFontAt(int index) const OVERRIDE {
- return (index == index_) ? font_ : NULL;
+ virtual ~FontListMenuModel() {}
+ virtual const gfx::FontList* GetLabelFontListAt(int index) const OVERRIDE {
+ return (index == index_) ? font_list_ : NULL;
}
private:
- const gfx::Font* font_;
+ const gfx::FontList* font_list_;
const int index_;
};
@@ -272,10 +273,11 @@ TEST_F(MenuControllerTest, Validate) {
}
// Tests that items which have a font set actually use that font.
-TEST_F(MenuControllerTest, LabelFont) {
+TEST_F(MenuControllerTest, LabelFontList) {
Delegate delegate;
- gfx::Font bold = (gfx::Font()).DeriveFont(0, gfx::Font::BOLD);
- FontMenuModel model(&delegate, &bold, 0);
+ const gfx::FontList& bold = ResourceBundle::GetSharedInstance().GetFontList(
+ ResourceBundle::BoldFont);
+ FontListMenuModel model(&delegate, &bold, 0);
model.AddItem(1, ASCIIToUTF16("one"));
model.AddItem(2, ASCIIToUTF16("two"));

Powered by Google App Engine
This is Rietveld 408576698