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
3 // found in the LICENSE file.
5 #include "ui/views/layout/grid_layout.h"
7 #include "base/compiler_specific.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/views/view.h"
13 void ExpectViewBoundsEquals(int x
, int y
, int w
, int h
,
15 EXPECT_EQ(x
, view
->x());
16 EXPECT_EQ(y
, view
->y());
17 EXPECT_EQ(w
, view
->width());
18 EXPECT_EQ(h
, view
->height());
21 class SettableSizeView
: public View
{
23 explicit SettableSizeView(const gfx::Size
& pref
) {
27 gfx::Size
GetPreferredSize() const override
{ return pref_
; }
33 // A view with fixed circumference that trades height for width.
34 class FlexibleView
: public View
{
36 explicit FlexibleView(int circumference
) {
37 circumference_
= circumference
;
40 gfx::Size
GetPreferredSize() const override
{
41 return gfx::Size(0, circumference_
/ 2);
44 int GetHeightForWidth(int width
) const override
{
45 return std::max(0, circumference_
/ 2 - width
);
52 class GridLayoutTest
: public testing::Test
{
54 GridLayoutTest() : layout(&host
) {}
57 for (int i
= host
.child_count() - 1; i
>= 0; i
--)
58 host
.RemoveChildView(host
.child_at(i
));
61 void GetPreferredSize() {
62 pref
= layout
.GetPreferredSize(&host
);
71 class GridLayoutAlignmentTest
: public testing::Test
{
73 GridLayoutAlignmentTest()
74 : v1(gfx::Size(10, 20)),
78 for (int i
= host
.child_count() - 1; i
>= 0; i
--)
79 host
.RemoveChildView(host
.child_at(i
));
82 void TestAlignment(GridLayout::Alignment alignment
, gfx::Rect
* bounds
) {
83 ColumnSet
* c1
= layout
.AddColumnSet(0);
84 c1
->AddColumn(alignment
, alignment
, 1, GridLayout::USE_PREF
, 0, 0);
85 layout
.StartRow(1, 0);
87 gfx::Size pref
= layout
.GetPreferredSize(&host
);
88 EXPECT_EQ(gfx::Size(10, 20), pref
);
89 host
.SetBounds(0, 0, 100, 100);
91 *bounds
= v1
.bounds();
100 TEST_F(GridLayoutAlignmentTest
, Fill
) {
102 TestAlignment(GridLayout::FILL
, &bounds
);
103 EXPECT_EQ(gfx::Rect(0, 0, 100, 100), bounds
);
106 TEST_F(GridLayoutAlignmentTest
, Leading
) {
108 TestAlignment(GridLayout::LEADING
, &bounds
);
109 EXPECT_EQ(gfx::Rect(0, 0, 10, 20), bounds
);
112 TEST_F(GridLayoutAlignmentTest
, Center
) {
114 TestAlignment(GridLayout::CENTER
, &bounds
);
115 EXPECT_EQ(gfx::Rect(45, 40, 10, 20), bounds
);
118 TEST_F(GridLayoutAlignmentTest
, Trailing
) {
120 TestAlignment(GridLayout::TRAILING
, &bounds
);
121 EXPECT_EQ(gfx::Rect(90, 80, 10, 20), bounds
);
124 TEST_F(GridLayoutTest
, TwoColumns
) {
125 SettableSizeView
v1(gfx::Size(10, 20));
126 SettableSizeView
v2(gfx::Size(20, 20));
127 ColumnSet
* c1
= layout
.AddColumnSet(0);
128 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
129 0, GridLayout::USE_PREF
, 0, 0);
130 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
131 0, GridLayout::USE_PREF
, 0, 0);
132 layout
.StartRow(0, 0);
137 EXPECT_EQ(gfx::Size(30, 20), pref
);
139 host
.SetBounds(0, 0, pref
.width(), pref
.height());
140 layout
.Layout(&host
);
141 ExpectViewBoundsEquals(0, 0, 10, 20, &v1
);
142 ExpectViewBoundsEquals(10, 0, 20, 20, &v2
);
147 TEST_F(GridLayoutTest
, ColSpan1
) {
148 SettableSizeView
v1(gfx::Size(100, 20));
149 SettableSizeView
v2(gfx::Size(10, 40));
150 ColumnSet
* c1
= layout
.AddColumnSet(0);
151 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
152 0, GridLayout::USE_PREF
, 0, 0);
153 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
154 1, GridLayout::USE_PREF
, 0, 0);
155 layout
.StartRow(0, 0);
156 layout
.AddView(&v1
, 2, 1);
157 layout
.StartRow(0, 0);
161 EXPECT_EQ(gfx::Size(100, 60), pref
);
163 host
.SetBounds(0, 0, pref
.width(), pref
.height());
164 layout
.Layout(&host
);
165 ExpectViewBoundsEquals(0, 0, 100, 20, &v1
);
166 ExpectViewBoundsEquals(0, 20, 10, 40, &v2
);
171 TEST_F(GridLayoutTest
, ColSpan2
) {
172 SettableSizeView
v1(gfx::Size(100, 20));
173 SettableSizeView
v2(gfx::Size(10, 20));
174 ColumnSet
* c1
= layout
.AddColumnSet(0);
175 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
176 1, GridLayout::USE_PREF
, 0, 0);
177 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
178 0, GridLayout::USE_PREF
, 0, 0);
179 layout
.StartRow(0, 0);
180 layout
.AddView(&v1
, 2, 1);
181 layout
.StartRow(0, 0);
182 layout
.SkipColumns(1);
186 EXPECT_EQ(gfx::Size(100, 40), pref
);
188 host
.SetBounds(0, 0, pref
.width(), pref
.height());
189 layout
.Layout(&host
);
190 ExpectViewBoundsEquals(0, 0, 100, 20, &v1
);
191 ExpectViewBoundsEquals(90, 20, 10, 20, &v2
);
196 TEST_F(GridLayoutTest
, ColSpan3
) {
197 SettableSizeView
v1(gfx::Size(100, 20));
198 SettableSizeView
v2(gfx::Size(10, 20));
199 SettableSizeView
v3(gfx::Size(10, 20));
200 ColumnSet
* c1
= layout
.AddColumnSet(0);
201 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
202 0, GridLayout::USE_PREF
, 0, 0);
203 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
204 0, GridLayout::USE_PREF
, 0, 0);
205 layout
.StartRow(0, 0);
206 layout
.AddView(&v1
, 2, 1);
207 layout
.StartRow(0, 0);
212 EXPECT_EQ(gfx::Size(100, 40), pref
);
214 host
.SetBounds(0, 0, pref
.width(), pref
.height());
215 layout
.Layout(&host
);
216 ExpectViewBoundsEquals(0, 0, 100, 20, &v1
);
217 ExpectViewBoundsEquals(0, 20, 10, 20, &v2
);
218 ExpectViewBoundsEquals(50, 20, 10, 20, &v3
);
224 TEST_F(GridLayoutTest
, ColSpan4
) {
225 ColumnSet
* set
= layout
.AddColumnSet(0);
227 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
, 0,
228 GridLayout::USE_PREF
, 0, 0);
229 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
, 0,
230 GridLayout::USE_PREF
, 0, 0);
232 SettableSizeView
v1(gfx::Size(10, 10));
233 SettableSizeView
v2(gfx::Size(10, 10));
234 SettableSizeView
v3(gfx::Size(25, 20));
235 layout
.StartRow(0, 0);
238 layout
.StartRow(0, 0);
239 layout
.AddView(&v3
, 2, 1);
242 EXPECT_EQ(gfx::Size(25, 30), pref
);
244 host
.SetBounds(0, 0, pref
.width(), pref
.height());
245 layout
.Layout(&host
);
246 ExpectViewBoundsEquals(0, 0, 10, 10, &v1
);
247 ExpectViewBoundsEquals(12, 0, 10, 10, &v2
);
248 ExpectViewBoundsEquals(0, 10, 25, 20, &v3
);
253 // Verifies the sizing of a view that doesn't start in the first column
254 // and has a column span > 1 (crbug.com/254092).
255 TEST_F(GridLayoutTest
, ColSpanStartSecondColumn
) {
256 ColumnSet
* set
= layout
.AddColumnSet(0);
258 set
->AddColumn(GridLayout::FILL
, GridLayout::FILL
, 0,
259 GridLayout::USE_PREF
, 0, 0);
260 set
->AddColumn(GridLayout::FILL
, GridLayout::FILL
, 0,
261 GridLayout::USE_PREF
, 0, 0);
262 set
->AddColumn(GridLayout::FILL
, GridLayout::FILL
, 0,
263 GridLayout::FIXED
, 10, 0);
265 SettableSizeView
v1(gfx::Size(10, 10));
266 SettableSizeView
v2(gfx::Size(20, 10));
268 layout
.StartRow(0, 0);
270 layout
.AddView(&v2
, 2, 1);
273 EXPECT_EQ(gfx::Size(30, 10), pref
);
275 host
.SetBounds(0, 0, pref
.width(), pref
.height());
276 layout
.Layout(&host
);
277 ExpectViewBoundsEquals(0, 0, 10, 10, &v1
);
278 ExpectViewBoundsEquals(10, 0, 20, 10, &v2
);
283 TEST_F(GridLayoutTest
, SameSizeColumns
) {
284 SettableSizeView
v1(gfx::Size(50, 20));
285 SettableSizeView
v2(gfx::Size(10, 10));
286 ColumnSet
* c1
= layout
.AddColumnSet(0);
287 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
288 0, GridLayout::USE_PREF
, 0, 0);
289 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
290 0, GridLayout::USE_PREF
, 0, 0);
291 c1
->LinkColumnSizes(0, 1, -1);
292 layout
.StartRow(0, 0);
296 gfx::Size pref
= layout
.GetPreferredSize(&host
);
297 EXPECT_EQ(gfx::Size(100, 20), pref
);
299 host
.SetBounds(0, 0, pref
.width(), pref
.height());
300 layout
.Layout(&host
);
301 ExpectViewBoundsEquals(0, 0, 50, 20, &v1
);
302 ExpectViewBoundsEquals(50, 0, 10, 10, &v2
);
307 TEST_F(GridLayoutTest
, HorizontalResizeTest1
) {
308 SettableSizeView
v1(gfx::Size(50, 20));
309 SettableSizeView
v2(gfx::Size(10, 10));
310 ColumnSet
* c1
= layout
.AddColumnSet(0);
311 c1
->AddColumn(GridLayout::FILL
, GridLayout::LEADING
,
312 1, GridLayout::USE_PREF
, 0, 0);
313 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
314 0, GridLayout::USE_PREF
, 0, 0);
315 layout
.StartRow(0, 0);
319 host
.SetBounds(0, 0, 110, 20);
320 layout
.Layout(&host
);
321 ExpectViewBoundsEquals(0, 0, 100, 20, &v1
);
322 ExpectViewBoundsEquals(100, 0, 10, 10, &v2
);
327 TEST_F(GridLayoutTest
, HorizontalResizeTest2
) {
328 SettableSizeView
v1(gfx::Size(50, 20));
329 SettableSizeView
v2(gfx::Size(10, 10));
330 ColumnSet
* c1
= layout
.AddColumnSet(0);
331 c1
->AddColumn(GridLayout::FILL
, GridLayout::LEADING
,
332 1, GridLayout::USE_PREF
, 0, 0);
333 c1
->AddColumn(GridLayout::TRAILING
, GridLayout::LEADING
,
334 1, GridLayout::USE_PREF
, 0, 0);
335 layout
.StartRow(0, 0);
339 host
.SetBounds(0, 0, 120, 20);
340 layout
.Layout(&host
);
341 ExpectViewBoundsEquals(0, 0, 80, 20, &v1
);
342 ExpectViewBoundsEquals(110, 0, 10, 10, &v2
);
347 // Tests that space leftover due to rounding is distributed to the last
349 TEST_F(GridLayoutTest
, HorizontalResizeTest3
) {
350 SettableSizeView
v1(gfx::Size(10, 10));
351 SettableSizeView
v2(gfx::Size(10, 10));
352 SettableSizeView
v3(gfx::Size(10, 10));
353 ColumnSet
* c1
= layout
.AddColumnSet(0);
354 c1
->AddColumn(GridLayout::FILL
, GridLayout::LEADING
,
355 1, GridLayout::USE_PREF
, 0, 0);
356 c1
->AddColumn(GridLayout::FILL
, GridLayout::LEADING
,
357 1, GridLayout::USE_PREF
, 0, 0);
358 c1
->AddColumn(GridLayout::TRAILING
, GridLayout::LEADING
,
359 0, GridLayout::USE_PREF
, 0, 0);
360 layout
.StartRow(0, 0);
365 host
.SetBounds(0, 0, 31, 10);
366 layout
.Layout(&host
);
367 ExpectViewBoundsEquals(0, 0, 10, 10, &v1
);
368 ExpectViewBoundsEquals(10, 0, 11, 10, &v2
);
369 ExpectViewBoundsEquals(21, 0, 10, 10, &v3
);
374 TEST_F(GridLayoutTest
, TestVerticalResize1
) {
375 SettableSizeView
v1(gfx::Size(50, 20));
376 SettableSizeView
v2(gfx::Size(10, 10));
377 ColumnSet
* c1
= layout
.AddColumnSet(0);
378 c1
->AddColumn(GridLayout::FILL
, GridLayout::FILL
,
379 1, GridLayout::USE_PREF
, 0, 0);
380 layout
.StartRow(1, 0);
382 layout
.StartRow(0, 0);
386 EXPECT_EQ(gfx::Size(50, 30), pref
);
388 host
.SetBounds(0, 0, 50, 100);
389 layout
.Layout(&host
);
390 ExpectViewBoundsEquals(0, 0, 50, 90, &v1
);
391 ExpectViewBoundsEquals(0, 90, 50, 10, &v2
);
396 TEST_F(GridLayoutTest
, Insets
) {
397 SettableSizeView
v1(gfx::Size(10, 20));
398 ColumnSet
* c1
= layout
.AddColumnSet(0);
399 layout
.SetInsets(1, 2, 3, 4);
400 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
401 0, GridLayout::USE_PREF
, 0, 0);
402 layout
.StartRow(0, 0);
406 EXPECT_EQ(gfx::Size(16, 24), pref
);
408 host
.SetBounds(0, 0, pref
.width(), pref
.height());
409 layout
.Layout(&host
);
410 ExpectViewBoundsEquals(2, 1, 10, 20, &v1
);
415 TEST_F(GridLayoutTest
, FixedSize
) {
416 layout
.SetInsets(2, 2, 2, 2);
418 ColumnSet
* set
= layout
.AddColumnSet(0);
420 int column_count
= 4;
421 int title_width
= 100;
424 int pref_height
= 20;
426 for (int i
= 0; i
< column_count
; ++i
) {
427 set
->AddColumn(GridLayout::CENTER
,
435 for (int row
= 0; row
< row_count
; ++row
) {
436 layout
.StartRow(0, 0);
437 for (int col
= 0; col
< column_count
; ++col
) {
438 layout
.AddView(new SettableSizeView(gfx::Size(pref_width
, pref_height
)));
442 layout
.Layout(&host
);
444 for (int i
= 0; i
< column_count
; ++i
) {
445 for (int row
= 0; row
< row_count
; ++row
) {
446 View
* view
= host
.child_at(row
* column_count
+ i
);
447 ExpectViewBoundsEquals(
448 2 + title_width
* i
+ (title_width
- pref_width
) / 2,
449 2 + pref_height
* row
,
456 EXPECT_EQ(gfx::Size(column_count
* title_width
+ 4,
457 row_count
* pref_height
+ 4), pref
);
460 TEST_F(GridLayoutTest
, RowSpanWithPaddingRow
) {
461 ColumnSet
* set
= layout
.AddColumnSet(0);
463 set
->AddColumn(GridLayout::CENTER
,
470 layout
.StartRow(0, 0);
471 layout
.AddView(new SettableSizeView(gfx::Size(10, 10)), 1, 2);
472 layout
.AddPaddingRow(0, 10);
475 TEST_F(GridLayoutTest
, RowSpan
) {
476 ColumnSet
* set
= layout
.AddColumnSet(0);
478 set
->AddColumn(GridLayout::LEADING
,
481 GridLayout::USE_PREF
,
484 set
->AddColumn(GridLayout::LEADING
,
487 GridLayout::USE_PREF
,
491 layout
.StartRow(0, 0);
492 layout
.AddView(new SettableSizeView(gfx::Size(20, 10)));
493 layout
.AddView(new SettableSizeView(gfx::Size(20, 40)), 1, 2);
494 layout
.StartRow(1, 0);
495 View
* s3
= new SettableSizeView(gfx::Size(20, 10));
499 EXPECT_EQ(gfx::Size(40, 40), pref
);
501 host
.SetBounds(0, 0, pref
.width(), pref
.height());
502 layout
.Layout(&host
);
503 ExpectViewBoundsEquals(0, 10, 20, 10, s3
);
506 TEST_F(GridLayoutTest
, RowSpan2
) {
507 ColumnSet
* set
= layout
.AddColumnSet(0);
509 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
510 0, GridLayout::USE_PREF
, 0, 0);
511 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
512 0,GridLayout::USE_PREF
, 0, 0);
514 layout
.StartRow(0, 0);
515 layout
.AddView(new SettableSizeView(gfx::Size(20, 20)));
516 View
* s3
= new SettableSizeView(gfx::Size(64, 64));
517 layout
.AddView(s3
, 1, 3);
519 layout
.AddPaddingRow(0, 10);
521 layout
.StartRow(0, 0);
522 layout
.AddView(new SettableSizeView(gfx::Size(10, 20)));
525 EXPECT_EQ(gfx::Size(84, 64), pref
);
527 host
.SetBounds(0, 0, pref
.width(), pref
.height());
528 layout
.Layout(&host
);
529 ExpectViewBoundsEquals(20, 0, 64, 64, s3
);
532 TEST_F(GridLayoutTest
, FixedViewWidth
) {
533 ColumnSet
* set
= layout
.AddColumnSet(0);
535 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
536 0, GridLayout::USE_PREF
, 0, 0);
537 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
538 0,GridLayout::USE_PREF
, 0, 0);
540 layout
.StartRow(0, 0);
541 View
* view
= new SettableSizeView(gfx::Size(30, 40));
542 layout
.AddView(view
, 1, 1, GridLayout::LEADING
, GridLayout::LEADING
, 10, 0);
545 EXPECT_EQ(10, pref
.width());
546 EXPECT_EQ(40, pref
.height());
548 host
.SetBounds(0, 0, pref
.width(), pref
.height());
549 layout
.Layout(&host
);
550 ExpectViewBoundsEquals(0, 0, 10, 40, view
);
553 TEST_F(GridLayoutTest
, FixedViewHeight
) {
554 ColumnSet
* set
= layout
.AddColumnSet(0);
556 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
557 0, GridLayout::USE_PREF
, 0, 0);
558 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
559 0,GridLayout::USE_PREF
, 0, 0);
561 layout
.StartRow(0, 0);
562 View
* view
= new SettableSizeView(gfx::Size(30, 40));
563 layout
.AddView(view
, 1, 1, GridLayout::LEADING
, GridLayout::LEADING
, 0, 10);
566 EXPECT_EQ(30, pref
.width());
567 EXPECT_EQ(10, pref
.height());
569 host
.SetBounds(0, 0, pref
.width(), pref
.height());
570 layout
.Layout(&host
);
571 ExpectViewBoundsEquals(0, 0, 30, 10, view
);
574 // Make sure that for views that span columns the underlying columns are resized
575 // based on the resize percent of the column.
576 TEST_F(GridLayoutTest
, ColumnSpanResizing
) {
577 ColumnSet
* set
= layout
.AddColumnSet(0);
579 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
580 2, GridLayout::USE_PREF
, 0, 0);
581 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
582 4, GridLayout::USE_PREF
, 0, 0);
584 layout
.StartRow(0, 0);
585 // span_view spans two columns and is twice as big the views added below.
586 View
* span_view
= new SettableSizeView(gfx::Size(12, 40));
587 layout
.AddView(span_view
, 2, 1, GridLayout::LEADING
, GridLayout::LEADING
);
589 layout
.StartRow(0, 0);
590 View
* view1
= new SettableSizeView(gfx::Size(2, 40));
591 View
* view2
= new SettableSizeView(gfx::Size(4, 40));
592 layout
.AddView(view1
);
593 layout
.AddView(view2
);
595 host
.SetBounds(0, 0, 12, 80);
596 layout
.Layout(&host
);
598 ExpectViewBoundsEquals(0, 0, 12, 40, span_view
);
600 // view1 should be 4 pixels wide
601 // column_pref + (remaining_width * column_resize / total_column_resize) =
603 ExpectViewBoundsEquals(0, 40, 4, 40, view1
);
605 // And view2 should be 8 pixels wide:
607 ExpectViewBoundsEquals(4, 40, 8, 40, view2
);
610 // Check that GetPreferredSize() takes resizing of columns into account when
611 // there is additional space in the case we have column sets of different
613 TEST_F(GridLayoutTest
, ColumnResizingOnGetPreferredSize
) {
614 ColumnSet
* set
= layout
.AddColumnSet(0);
615 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
616 1, GridLayout::USE_PREF
, 0, 0);
618 set
= layout
.AddColumnSet(1);
619 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
620 1, GridLayout::USE_PREF
, 0, 0);
622 set
= layout
.AddColumnSet(2);
623 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
624 1, GridLayout::USE_PREF
, 0, 0);
626 // Make a row containing a flexible view that trades width for height.
627 layout
.StartRow(0, 0);
628 View
* view1
= new FlexibleView(100);
629 layout
.AddView(view1
, 1, 1, GridLayout::FILL
, GridLayout::LEADING
);
631 // The second row contains a view of fixed size that will enforce a column
632 // width of 20 pixels.
633 layout
.StartRow(0, 1);
634 View
* view2
= new SettableSizeView(gfx::Size(20, 20));
635 layout
.AddView(view2
, 1, 1, GridLayout::FILL
, GridLayout::LEADING
);
637 // Add another flexible view in row three in order to ensure column set
638 // ordering doesn't influence sizing behaviour.
639 layout
.StartRow(0, 2);
640 View
* view3
= new FlexibleView(40);
641 layout
.AddView(view3
, 1, 1, GridLayout::FILL
, GridLayout::LEADING
);
643 // We expect a height of 50: 30 from the variable width view in the first row
644 // plus 20 from the statically sized view in the second row. The flexible
645 // view in the third row should contribute no height.
646 EXPECT_EQ(gfx::Size(20, 50), layout
.GetPreferredSize(&host
));
649 TEST_F(GridLayoutTest
, MinimumPreferredSize
) {
650 SettableSizeView
v1(gfx::Size(10, 20));
651 ColumnSet
* set
= layout
.AddColumnSet(0);
652 set
->AddColumn(GridLayout::FILL
, GridLayout::FILL
,
653 0, GridLayout::USE_PREF
, 0, 0);
654 layout
.StartRow(0, 0);
658 EXPECT_EQ(gfx::Size(10, 20), pref
);
660 layout
.set_minimum_size(gfx::Size(40, 40));
662 EXPECT_EQ(gfx::Size(40, 40), pref
);