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

Unified Diff: ui/views/controls/button/image_button_unittest.cc

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: WIP: use observer 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/button/image_button_unittest.cc
diff --git a/ui/views/controls/button/image_button_unittest.cc b/ui/views/controls/button/image_button_unittest.cc
index ccd62cef04682685788478535da0493b1d1f3205..320a8f2708bd9e970092a6b2100ec51c9b2fe210 100644
--- a/ui/views/controls/button/image_button_unittest.cc
+++ b/ui/views/controls/button/image_button_unittest.cc
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ui/views/controls/button/image_button.h"
+
#include "base/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/layout.h"
+#include "ui/vector_icons/vector_icons.h"
#include "ui/views/border.h"
-#include "ui/views/controls/button/image_button.h"
#include "ui/views/test/views_test_base.h"
namespace {
@@ -199,4 +201,16 @@ TEST_F(ImageButtonTest, PreferredSizeInvalidation) {
EXPECT_EQ(1, parent.pref_size_changed_calls());
}
+TEST_F(ImageButtonTest, Padding) {
+ ImageButton button(nullptr);
+ gfx::ImageSkia image = CreateTestImage(5, 10);
+ button.SetImage(CustomButton::STATE_NORMAL, &image);
+
+ button.SetPadding(gfx::Insets(2, 5, 7, 13));
+ EXPECT_EQ("23x19", button.GetPreferredSize().ToString());
+
+ button.SetPadding(gfx::Insets());
+ EXPECT_EQ("5x10", button.GetPreferredSize().ToString());
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698