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

Side by Side Diff: ash/common/system/tray/tri_view_unittest.cc

Issue 2487603005: Adjust TriView. (Closed)
Patch Set: merge Created 4 years, 1 month 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
« no previous file with comments | « ash/common/system/tray/tri_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 6
7 #include "ash/common/system/tray/tri_view.h" 7 #include "ash/common/system/tray/tri_view.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/geometry/insets.h" 10 #include "ui/gfx/geometry/insets.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 tri_view_->AddView(TriView::Container::CENTER, center_child); 91 tri_view_->AddView(TriView::Container::CENTER, center_child);
92 tri_view_->AddView(TriView::Container::END, end_child); 92 tri_view_->AddView(TriView::Container::END, end_child);
93 93
94 tri_view_->Layout(); 94 tri_view_->Layout();
95 95
96 EXPECT_EQ(0, GetBoundsInHost(start_child).y()); 96 EXPECT_EQ(0, GetBoundsInHost(start_child).y());
97 EXPECT_EQ(kViewWidth, GetBoundsInHost(center_child).y()); 97 EXPECT_EQ(kViewWidth, GetBoundsInHost(center_child).y());
98 EXPECT_EQ(kViewWidth * 2, GetBoundsInHost(end_child).y()); 98 EXPECT_EQ(kViewWidth * 2, GetBoundsInHost(end_child).y());
99 } 99 }
100 100
101 TEST_F(TriViewTest, MinCrossAxisSize) {
102 const int kMinCrossAxisSize = 15;
103 EXPECT_EQ(0, tri_view_->GetPreferredSize().height());
104 tri_view_->SetMinCrossAxisSize(kMinCrossAxisSize);
105 EXPECT_EQ(kMinCrossAxisSize, tri_view_->GetPreferredSize().height());
106 EXPECT_EQ(kMinCrossAxisSize, tri_view_->GetHeightForWidth(0));
107 }
108
109 TEST_F(TriViewTest, MainAxisMinSize) { 101 TEST_F(TriViewTest, MainAxisMinSize) {
110 tri_view_->SetBounds(0, 0, 100, 10); 102 tri_view_->SetBounds(0, 0, 100, 10);
111 const gfx::Size kMinSize(15, 10); 103 const gfx::Size kMinSize(15, 10);
112 tri_view_->SetMinSize(TriView::Container::START, kMinSize); 104 tri_view_->SetMinSize(TriView::Container::START, kMinSize);
113 views::View* child = new views::StaticSizedView(gfx::Size(10, 10)); 105 views::View* child = new views::StaticSizedView(gfx::Size(10, 10));
114 tri_view_->AddView(TriView::Container::CENTER, child); 106 tri_view_->AddView(TriView::Container::CENTER, child);
115 107
116 tri_view_->Layout(); 108 tri_view_->Layout();
117 109
118 EXPECT_EQ(kMinSize.width(), GetBoundsInHost(child).x()); 110 EXPECT_EQ(kMinSize.width(), GetBoundsInHost(child).x());
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 tri_view_->SetMaxSize(TriView::Container::CENTER, kMaxCenterSize); 314 tri_view_->SetMaxSize(TriView::Container::CENTER, kMaxCenterSize);
323 tri_view_->Layout(); 315 tri_view_->Layout();
324 316
325 EXPECT_EQ(kViewSize, GetBoundsInHost(start_child).size()); 317 EXPECT_EQ(kViewSize, GetBoundsInHost(start_child).size());
326 EXPECT_EQ(kExpectedCenterSize, 318 EXPECT_EQ(kExpectedCenterSize,
327 GetBoundsInHost(GetContainer(TriView::Container::CENTER)).size()); 319 GetBoundsInHost(GetContainer(TriView::Container::CENTER)).size());
328 EXPECT_EQ(kViewSize, GetBoundsInHost(end_child).size()); 320 EXPECT_EQ(kViewSize, GetBoundsInHost(end_child).size());
329 } 321 }
330 322
331 } // namespace ash 323 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tri_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698