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

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

Issue 2111323003: Turn off the auto color readability of LabelButton in non-high contrast mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test for this CL Created 4 years, 5 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
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/label_button_unittest.cc
diff --git a/ui/views/controls/button/label_button_unittest.cc b/ui/views/controls/button/label_button_unittest.cc
index 1b13b8c50a2e865769dae571f62bafe738a6289a..5c94c30fe039fb8fa5bb416bfcbfc86b3dffc632 100644
--- a/ui/views/controls/button/label_button_unittest.cc
+++ b/ui/views/controls/button/label_button_unittest.cc
@@ -14,6 +14,7 @@
#include "ui/base/ui_base_switches.h"
#include "ui/events/test/event_generator.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/color_utils.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/vector2d.h"
@@ -405,6 +406,21 @@ TEST_F(LabelButtonTest, HighlightedButtonStyle) {
default_before->label()->enabled_color());
}
+// Ensure the label gets the correct enabled color after
+// LabelButton::ResetColorsFromNativeTheme() is invoked.
+TEST_F(LabelButtonTest, ResetColorsFromNativeTheme) {
+ ASSERT_FALSE(color_utils::IsInvertedColorScheme());
+ ASSERT_NE(button_->label()->background_color(), SK_ColorBLACK);
+ EXPECT_EQ(themed_normal_text_color_, button_->label()->enabled_color());
+
+ button_->label()->SetBackgroundColor(SK_ColorBLACK);
+ button_->label()->SetAutoColorReadabilityEnabled(true);
+ EXPECT_NE(themed_normal_text_color_, button_->label()->enabled_color());
+
+ button_->ResetColorsFromNativeTheme();
+ EXPECT_EQ(themed_normal_text_color_, button_->label()->enabled_color());
+}
+
// Test fixture for a LabelButton that has an ink drop configured.
class InkDropLabelButtonTest : public ViewsTestBase {
public:
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698