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

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

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: tests 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_util.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 ImageButtonUtilTest;
17
18 TEST_F(ImageButtonUtilTest, CreateImageButtonWithVectorIconStyling) {
19 ImageButton* button = CreateImageButtonWithVectorIconStyling(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(ImageButtonUtilTest, SetImageFromVectorIcon) {
27 ImageButton* button = CreateImageButtonWithVectorIconStyling(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 delete button;
34 }
35
36 } // views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698