| OLD | NEW |
| (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 |
| OLD | NEW |