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

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

Issue 101573006: Changes MouseEvent constructor to take changed_button_flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test; needs updated expectations as mouse entered wasnt sent before because of env::mouse_butto… Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/radio_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/base/layout.h" 8 #include "ui/base/layout.h"
9 #include "ui/gfx/screen.h" 9 #include "ui/gfx/screen.h"
10 #include "ui/views/controls/button/checkbox.h" 10 #include "ui/views/controls/button/checkbox.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 widget->GetNativeView())->GetCursorScreenPoint(); 73 widget->GetNativeView())->GetCursorScreenPoint();
74 gfx::Rect widget_bounds = widget->GetWindowBoundsInScreen(); 74 gfx::Rect widget_bounds = widget->GetWindowBoundsInScreen();
75 widget_bounds.set_origin(cursor); 75 widget_bounds.set_origin(cursor);
76 widget->SetBounds(widget_bounds); 76 widget->SetBounds(widget_bounds);
77 77
78 TestCustomButton* button = new TestCustomButton(NULL); 78 TestCustomButton* button = new TestCustomButton(NULL);
79 widget->SetContentsView(button); 79 widget->SetContentsView(button);
80 80
81 gfx::Point center(10, 10); 81 gfx::Point center(10, 10);
82 button->OnMousePressed(ui::MouseEvent(ui::ET_MOUSE_PRESSED, center, center, 82 button->OnMousePressed(ui::MouseEvent(ui::ET_MOUSE_PRESSED, center, center,
83 ui::EF_LEFT_MOUSE_BUTTON,
83 ui::EF_LEFT_MOUSE_BUTTON)); 84 ui::EF_LEFT_MOUSE_BUTTON));
84 EXPECT_EQ(CustomButton::STATE_PRESSED, button->state()); 85 EXPECT_EQ(CustomButton::STATE_PRESSED, button->state());
85 86
86 button->OnMouseReleased(ui::MouseEvent(ui::ET_MOUSE_RELEASED, center, center, 87 button->OnMouseReleased(ui::MouseEvent(ui::ET_MOUSE_RELEASED, center, center,
88 ui::EF_LEFT_MOUSE_BUTTON,
87 ui::EF_LEFT_MOUSE_BUTTON)); 89 ui::EF_LEFT_MOUSE_BUTTON));
88 EXPECT_EQ(CustomButton::STATE_HOVERED, button->state()); 90 EXPECT_EQ(CustomButton::STATE_HOVERED, button->state());
89 91
90 button->SetEnabled(false); 92 button->SetEnabled(false);
91 EXPECT_EQ(CustomButton::STATE_DISABLED, button->state()); 93 EXPECT_EQ(CustomButton::STATE_DISABLED, button->state());
92 94
93 button->SetEnabled(true); 95 button->SetEnabled(true);
94 EXPECT_EQ(CustomButton::STATE_HOVERED, button->state()); 96 EXPECT_EQ(CustomButton::STATE_HOVERED, button->state());
95 97
96 button->SetVisible(false); 98 button->SetVisible(false);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 EXPECT_FALSE(CustomButton::AsCustomButton(&label)); 176 EXPECT_FALSE(CustomButton::AsCustomButton(&label));
175 177
176 Link link(text); 178 Link link(text);
177 EXPECT_FALSE(CustomButton::AsCustomButton(&link)); 179 EXPECT_FALSE(CustomButton::AsCustomButton(&link));
178 180
179 Textfield textfield(Textfield::STYLE_DEFAULT); 181 Textfield textfield(Textfield::STYLE_DEFAULT);
180 EXPECT_FALSE(CustomButton::AsCustomButton(&textfield)); 182 EXPECT_FALSE(CustomButton::AsCustomButton(&textfield));
181 } 183 }
182 184
183 } // namespace views 185 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/radio_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698