| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/controls/button/label_button.h" | 5 #include "ui/views/controls/button/label_button.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 WidgetTest::SetUp(); | 73 WidgetTest::SetUp(); |
| 74 // Make a Widget to host the button. This ensures appropriate borders are | 74 // Make a Widget to host the button. This ensures appropriate borders are |
| 75 // used (which could be derived from the Widget's NativeTheme). | 75 // used (which could be derived from the Widget's NativeTheme). |
| 76 test_widget_ = CreateTopLevelPlatformWidget(); | 76 test_widget_ = CreateTopLevelPlatformWidget(); |
| 77 | 77 |
| 78 button_ = new TestLabelButton; | 78 button_ = new TestLabelButton; |
| 79 test_widget_->GetContentsView()->AddChildView(button_); | 79 test_widget_->GetContentsView()->AddChildView(button_); |
| 80 | 80 |
| 81 // Establish the expected text colors for testing changes due to state. | 81 // Establish the expected text colors for testing changes due to state. |
| 82 themed_normal_text_color_ = button_->GetNativeTheme()->GetSystemColor( | 82 themed_normal_text_color_ = button_->GetNativeTheme()->GetSystemColor( |
| 83 ui::NativeTheme::kColorId_ButtonEnabledColor); | 83 ui::NativeTheme::kColorId_LabelEnabledColor); |
| 84 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 84 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 85 // The Linux theme provides a non-black highlight text color, but it's not | 85 // The Linux theme provides a non-black highlight text color, but it's not |
| 86 // used for styled buttons. | 86 // used for styled buttons. |
| 87 styled_highlight_text_color_ = themed_normal_text_color_; | 87 styled_highlight_text_color_ = styled_normal_text_color_ = |
| 88 styled_normal_text_color_ = themed_normal_text_color_; | 88 button_->GetNativeTheme()->GetSystemColor( |
| 89 ui::NativeTheme::kColorId_ButtonEnabledColor); |
| 89 #else | 90 #else |
| 90 styled_highlight_text_color_ = button_->GetNativeTheme()->GetSystemColor( | 91 styled_highlight_text_color_ = button_->GetNativeTheme()->GetSystemColor( |
| 91 ui::NativeTheme::kColorId_ButtonHighlightColor); | 92 ui::NativeTheme::kColorId_ButtonHighlightColor); |
| 92 | 93 |
| 93 // For styled buttons only, platforms other than Desktop Linux either ignore | 94 // For styled buttons only, platforms other than Desktop Linux either ignore |
| 94 // NativeTheme and use a hardcoded black or (on Mac) have a NativeTheme that | 95 // NativeTheme and use a hardcoded black or (on Mac) have a NativeTheme that |
| 95 // reliably returns black. | 96 // reliably returns black. |
| 96 styled_normal_text_color_ = SK_ColorBLACK; | 97 styled_normal_text_color_ = SK_ColorBLACK; |
| 97 #endif | 98 #endif |
| 98 } | 99 } |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 502 |
| 502 // Verifies the target event handler View is the |LabelButton| and not any of | 503 // Verifies the target event handler View is the |LabelButton| and not any of |
| 503 // the child Views. | 504 // the child Views. |
| 504 TEST_F(InkDropLabelButtonTest, TargetEventHandler) { | 505 TEST_F(InkDropLabelButtonTest, TargetEventHandler) { |
| 505 View* target_view = widget_->GetRootView()->GetEventHandlerForPoint( | 506 View* target_view = widget_->GetRootView()->GetEventHandlerForPoint( |
| 506 button_->bounds().CenterPoint()); | 507 button_->bounds().CenterPoint()); |
| 507 EXPECT_EQ(button_, target_view); | 508 EXPECT_EQ(button_, target_view); |
| 508 } | 509 } |
| 509 | 510 |
| 510 } // namespace views | 511 } // namespace views |
| OLD | NEW |