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

Side by Side Diff: ui/views/controls/button/image_button_factory_unittest.cc

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: check details 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/views/controls/button/image_button_factory.h"
6
7 #include "ui/gfx/color_utils.h"
8 #include "ui/vector_icons/vector_icons.h"
9 #include "ui/views/animation/test/ink_drop_host_view_test_api.h"
10 #include "ui/views/controls/button/button.h"
11 #include "ui/views/controls/button/image_button.h"
12 #include "ui/views/test/views_test_base.h"
13
14 namespace views {
15
16 typedef ViewsTestBase ImageButtonFactoryTest;
17
18 TEST_F(ImageButtonFactoryTest, CreateVectorImageButton) {
19 ImageButton* button = CreateVectorImageButton(nullptr);
20 EXPECT_EQ(ImageButton::ALIGN_CENTER, button->h_alignment_);
21 EXPECT_EQ(ImageButton::ALIGN_MIDDLE, button->v_alignment_);
22 EXPECT_TRUE(test::InkDropHostViewTestApi(button).HasGestureHandler());
23 delete button;
24 }
25
26 TEST_F(ImageButtonFactoryTest, SetImageFromVectorIcon) {
27 ImageButton* button = CreateVectorImageButton(nullptr);
28 SetImageFromVectorIcon(button, ui::kCloseIcon, SK_ColorRED);
29 EXPECT_FALSE(button->GetImage(CustomButton::STATE_NORMAL).isNull());
30 EXPECT_FALSE(button->GetImage(CustomButton::STATE_DISABLED).isNull());
31 EXPECT_EQ(color_utils::DeriveDefaultIconColor(SK_ColorRED),
32 button->GetInkDropBaseColor());
33
34 // Default to black.
35 SetImageFromVectorIcon(button, ui::kCloseIcon);
36 EXPECT_EQ(color_utils::DeriveDefaultIconColor(SK_ColorBLACK),
37 button->GetInkDropBaseColor());
38 delete button;
39 }
40
41 } // views
OLDNEW
« no previous file with comments | « ui/views/controls/button/image_button_factory.cc ('k') | ui/views/controls/button/vector_icon_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698