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

Unified Diff: ui/message_center/views/notification_view_unittest.cc

Issue 305633004: Puts notification buttons back below the image (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds a test. Created 6 years, 7 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/message_center/views/notification_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/notification_view_unittest.cc
diff --git a/ui/message_center/views/notification_view_unittest.cc b/ui/message_center/views/notification_view_unittest.cc
index 596e9ae792829e27cb78fddbb808464bcc9b7e70..b2a613fbf8ae837f6b6fa87549b18bb2c06e1ab0 100644
--- a/ui/message_center/views/notification_view_unittest.cc
+++ b/ui/message_center/views/notification_view_unittest.cc
@@ -277,4 +277,53 @@ TEST_F(NotificationViewTest, UpdateButtonCountTest) {
EXPECT_TRUE(NULL == notification_view()->action_buttons_[0]->background());
}
+TEST_F(NotificationViewTest, ViewOrderingTest) {
+ // Tests that views remain in the correct order even after an update.
+ notification()->set_buttons(CreateButtons(2));
+ // Layout the initial views.
+ notification_view()->CreateOrUpdateViews(*notification());
+ widget()->Show();
+
+ std::vector<views::View*> vertical_order;
+ vertical_order.push_back(notification_view()->top_view_);
+ vertical_order.push_back(notification_view()->image_view_);
+ std::copy(notification_view()->action_buttons_.begin(),
+ notification_view()->action_buttons_.end(),
+ std::back_inserter(vertical_order));
+
+ std::vector<views::View*>::iterator last = vertical_order.begin();
+ std::vector<views::View*>::iterator current = last;
+ ++current;
+ while (current != vertical_order.end()) {
+ gfx::Point last_point = (*last)->bounds().CenterPoint();
+ views::View::ConvertPointToTarget(
+ (*last), notification_view(), &last_point);
+
+ gfx::Point current_point = (*current)->bounds().CenterPoint();
+ views::View::ConvertPointToTarget(
+ (*current), notification_view(), &current_point);
+
+ EXPECT_LT(last_point.y(), current_point.y());
+ last = current++;
+ }
+
+ notification_view()->CreateOrUpdateViews(*notification());
robliao 2014/05/28 17:55:48 Seems like we're repeating what we just tested. Wh
dewittj 2014/05/28 18:59:04 The bug only repros when createorupdateviews is ca
robliao 2014/05/28 19:29:05 Let's put a note about that here before this gets
dewittj 2014/05/30 00:44:36 Done.
+
+ last = vertical_order.begin();
+ current = last;
+ ++current;
+ while (current != vertical_order.end()) {
+ gfx::Point last_point = (*last)->bounds().CenterPoint();
+ views::View::ConvertPointToTarget(
+ (*last), notification_view(), &last_point);
+
+ gfx::Point current_point = (*current)->bounds().CenterPoint();
+ views::View::ConvertPointToTarget(
+ (*current), notification_view(), &current_point);
+
+ EXPECT_LT(last_point.y(), current_point.y());
+ last = current++;
+ }
+}
+
} // namespace message_center
« no previous file with comments | « ui/message_center/views/notification_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698