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

Unified Diff: ash/system/tray/tri_view_unittest.cc

Issue 2932053003: [ash] Made TriView's re-layout automatically when a child container's visibility changes. (Closed)
Patch Set: Fixed compile error. Created 3 years, 6 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 | « ash/system/tray/tri_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/tri_view_unittest.cc
diff --git a/ash/system/tray/tri_view_unittest.cc b/ash/system/tray/tri_view_unittest.cc
index c949063b545dbb1a4273ee81259f73fe6d2d430a..52dcc4e3ae18d8f3ad437afdff350fd688ab1b27 100644
--- a/ash/system/tray/tri_view_unittest.cc
+++ b/ash/system/tray/tri_view_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <memory>
+#include <utility>
#include "ash/system/tray/tri_view.h"
#include "base/memory/ptr_util.h"
@@ -377,4 +378,34 @@ TEST_F(TriViewTest, SetMinHeight) {
EXPECT_EQ(kMinHeight, GetMinHeight(TriView::Container::END));
}
+TEST_F(TriViewTest, ChangingContainersVisibilityPerformsLayout) {
+ const int kViewWidth = 10;
+ const int kViewHeight = 10;
+ const gfx::Size kEndViewSize(kViewWidth, kViewHeight);
+
+ tri_view_->SetBounds(0, 0, 3 * kViewWidth, kViewHeight);
+ tri_view_->SetFlexForContainer(TriView::Container::CENTER, 1.f);
+
+ views::View* start_child = new views::View();
+ start_child->SetPreferredSize(kEndViewSize);
+
+ views::View* center_child = new views::View();
+ center_child->SetPreferredSize(gfx::Size(2 * kViewWidth, kViewHeight));
+
+ views::View* end_child = new views::View();
+ end_child->SetPreferredSize(kEndViewSize);
+
+ tri_view_->AddView(TriView::Container::START, start_child);
+ tri_view_->AddView(TriView::Container::CENTER, center_child);
+ tri_view_->AddView(TriView::Container::END, end_child);
+
+ tri_view_->Layout();
+
+ EXPECT_EQ(gfx::Size(kViewWidth, kViewHeight), center_child->size());
+
+ tri_view_->SetContainerVisible(TriView::Container::END, false);
+
+ EXPECT_EQ(gfx::Size(2 * kViewWidth, kViewHeight), center_child->size());
+}
+
} // namespace ash
« no previous file with comments | « ash/system/tray/tri_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698