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 virtual gfx::Size
GetPreferredSize() const OVERRIDE
{
35 // A view with fixed circumference that trades height for width.
36 class FlexibleView
: public View
{
38 explicit FlexibleView(int circumference
) {
39 circumference_
= circumference
;
42 virtual gfx::Size
GetPreferredSize() const OVERRIDE
{
43 return gfx::Size(0, circumference_
/ 2);
46 virtual int GetHeightForWidth(int width
) const OVERRIDE
{
47 return std::max(0, circumference_
/ 2 - width
);
54 class GridLayoutTest
: public testing::Test
{
56 GridLayoutTest() : layout(&host
) {}
59 for (int i
= host
.child_count() - 1; i
>= 0; i
--)
60 host
.RemoveChildView(host
.child_at(i
));
63 void GetPreferredSize() {
64 pref
= layout
.GetPreferredSize(&host
);
73 class GridLayoutAlignmentTest
: public testing::Test
{
75 GridLayoutAlignmentTest()
76 : v1(gfx::Size(10, 20)),
80 for (int i
= host
.child_count() - 1; i
>= 0; i
--)
81 host
.RemoveChildView(host
.child_at(i
));
84 void TestAlignment(GridLayout::Alignment alignment
, gfx::Rect
* bounds
) {
85 ColumnSet
* c1
= layout
.AddColumnSet(0);
86 c1
->AddColumn(alignment
, alignment
, 1, GridLayout::USE_PREF
, 0, 0);
87 layout
.StartRow(1, 0);
89 gfx::Size pref
= layout
.GetPreferredSize(&host
);
90 EXPECT_EQ(gfx::Size(10, 20), pref
);
91 host
.SetBounds(0, 0, 100, 100);
93 *bounds
= v1
.bounds();
102 TEST_F(GridLayoutAlignmentTest
, Fill
) {
104 TestAlignment(GridLayout::FILL
, &bounds
);
105 EXPECT_EQ(gfx::Rect(0, 0, 100, 100), bounds
);
108 TEST_F(GridLayoutAlignmentTest
, Leading
) {
110 TestAlignment(GridLayout::LEADING
, &bounds
);
111 EXPECT_EQ(gfx::Rect(0, 0, 10, 20), bounds
);
114 TEST_F(GridLayoutAlignmentTest
, Center
) {
116 TestAlignment(GridLayout::CENTER
, &bounds
);
117 EXPECT_EQ(gfx::Rect(45, 40, 10, 20), bounds
);
120 TEST_F(GridLayoutAlignmentTest
, Trailing
) {
122 TestAlignment(GridLayout::TRAILING
, &bounds
);
123 EXPECT_EQ(gfx::Rect(90, 80, 10, 20), bounds
);
126 TEST_F(GridLayoutTest
, TwoColumns
) {
127 SettableSizeView
v1(gfx::Size(10, 20));
128 SettableSizeView
v2(gfx::Size(20, 20));
129 ColumnSet
* c1
= layout
.AddColumnSet(0);
130 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
131 0, GridLayout::USE_PREF
, 0, 0);
132 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
133 0, GridLayout::USE_PREF
, 0, 0);
134 layout
.StartRow(0, 0);
139 EXPECT_EQ(gfx::Size(30, 20), pref
);
141 host
.SetBounds(0, 0, pref
.width(), pref
.height());
142 layout
.Layout(&host
);
143 ExpectViewBoundsEquals(0, 0, 10, 20, &v1
);
144 ExpectViewBoundsEquals(10, 0, 20, 20, &v2
);
149 TEST_F(GridLayoutTest
, ColSpan1
) {
150 SettableSizeView
v1(gfx::Size(100, 20));
151 SettableSizeView
v2(gfx::Size(10, 40));
152 ColumnSet
* c1
= layout
.AddColumnSet(0);
153 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
154 0, GridLayout::USE_PREF
, 0, 0);
155 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
156 1, GridLayout::USE_PREF
, 0, 0);
157 layout
.StartRow(0, 0);
158 layout
.AddView(&v1
, 2, 1);
159 layout
.StartRow(0, 0);
163 EXPECT_EQ(gfx::Size(100, 60), pref
);
165 host
.SetBounds(0, 0, pref
.width(), pref
.height());
166 layout
.Layout(&host
);
167 ExpectViewBoundsEquals(0, 0, 100, 20, &v1
);
168 ExpectViewBoundsEquals(0, 20, 10, 40, &v2
);
173 TEST_F(GridLayoutTest
, ColSpan2
) {
174 SettableSizeView
v1(gfx::Size(100, 20));
175 SettableSizeView
v2(gfx::Size(10, 20));
176 ColumnSet
* c1
= layout
.AddColumnSet(0);
177 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
178 1, GridLayout::USE_PREF
, 0, 0);
179 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
180 0, GridLayout::USE_PREF
, 0, 0);
181 layout
.StartRow(0, 0);
182 layout
.AddView(&v1
, 2, 1);
183 layout
.StartRow(0, 0);
184 layout
.SkipColumns(1);
188 EXPECT_EQ(gfx::Size(100, 40), pref
);
190 host
.SetBounds(0, 0, pref
.width(), pref
.height());
191 layout
.Layout(&host
);
192 ExpectViewBoundsEquals(0, 0, 100, 20, &v1
);
193 ExpectViewBoundsEquals(90, 20, 10, 20, &v2
);
198 TEST_F(GridLayoutTest
, ColSpan3
) {
199 SettableSizeView
v1(gfx::Size(100, 20));
200 SettableSizeView
v2(gfx::Size(10, 20));
201 SettableSizeView
v3(gfx::Size(10, 20));
202 ColumnSet
* c1
= layout
.AddColumnSet(0);
203 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
204 0, GridLayout::USE_PREF
, 0, 0);
205 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
206 0, GridLayout::USE_PREF
, 0, 0);
207 layout
.StartRow(0, 0);
208 layout
.AddView(&v1
, 2, 1);
209 layout
.StartRow(0, 0);
214 EXPECT_EQ(gfx::Size(100, 40), pref
);
216 host
.SetBounds(0, 0, pref
.width(), pref
.height());
217 layout
.Layout(&host
);
218 ExpectViewBoundsEquals(0, 0, 100, 20, &v1
);
219 ExpectViewBoundsEquals(0, 20, 10, 20, &v2
);
220 ExpectViewBoundsEquals(50, 20, 10, 20, &v3
);
226 TEST_F(GridLayoutTest
, ColSpan4
) {
227 ColumnSet
* set
= layout
.AddColumnSet(0);
229 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
, 0,
230 GridLayout::USE_PREF
, 0, 0);
231 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
, 0,
232 GridLayout::USE_PREF
, 0, 0);
234 SettableSizeView
v1(gfx::Size(10, 10));
235 SettableSizeView
v2(gfx::Size(10, 10));
236 SettableSizeView
v3(gfx::Size(25, 20));
237 layout
.StartRow(0, 0);
240 layout
.StartRow(0, 0);
241 layout
.AddView(&v3
, 2, 1);
244 EXPECT_EQ(gfx::Size(25, 30), pref
);
246 host
.SetBounds(0, 0, pref
.width(), pref
.height());
247 layout
.Layout(&host
);
248 ExpectViewBoundsEquals(0, 0, 10, 10, &v1
);
249 ExpectViewBoundsEquals(12, 0, 10, 10, &v2
);
250 ExpectViewBoundsEquals(0, 10, 25, 20, &v3
);
255 // Verifies the sizing of a view that doesn't start in the first column
256 // and has a column span > 1 (crbug.com/254092).
257 TEST_F(GridLayoutTest
, ColSpanStartSecondColumn
) {
258 ColumnSet
* set
= layout
.AddColumnSet(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::USE_PREF
, 0, 0);
264 set
->AddColumn(GridLayout::FILL
, GridLayout::FILL
, 0,
265 GridLayout::FIXED
, 10, 0);
267 SettableSizeView
v1(gfx::Size(10, 10));
268 SettableSizeView
v2(gfx::Size(20, 10));
270 layout
.StartRow(0, 0);
272 layout
.AddView(&v2
, 2, 1);
275 EXPECT_EQ(gfx::Size(30, 10), pref
);
277 host
.SetBounds(0, 0, pref
.width(), pref
.height());
278 layout
.Layout(&host
);
279 ExpectViewBoundsEquals(0, 0, 10, 10, &v1
);
280 ExpectViewBoundsEquals(10, 0, 20, 10, &v2
);
285 TEST_F(GridLayoutTest
, SameSizeColumns
) {
286 SettableSizeView
v1(gfx::Size(50, 20));
287 SettableSizeView
v2(gfx::Size(10, 10));
288 ColumnSet
* c1
= layout
.AddColumnSet(0);
289 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
290 0, GridLayout::USE_PREF
, 0, 0);
291 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
292 0, GridLayout::USE_PREF
, 0, 0);
293 c1
->LinkColumnSizes(0, 1, -1);
294 layout
.StartRow(0, 0);
298 gfx::Size pref
= layout
.GetPreferredSize(&host
);
299 EXPECT_EQ(gfx::Size(100, 20), pref
);
301 host
.SetBounds(0, 0, pref
.width(), pref
.height());
302 layout
.Layout(&host
);
303 ExpectViewBoundsEquals(0, 0, 50, 20, &v1
);
304 ExpectViewBoundsEquals(50, 0, 10, 10, &v2
);
309 TEST_F(GridLayoutTest
, HorizontalResizeTest1
) {
310 SettableSizeView
v1(gfx::Size(50, 20));
311 SettableSizeView
v2(gfx::Size(10, 10));
312 ColumnSet
* c1
= layout
.AddColumnSet(0);
313 c1
->AddColumn(GridLayout::FILL
, GridLayout::LEADING
,
314 1, GridLayout::USE_PREF
, 0, 0);
315 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
316 0, GridLayout::USE_PREF
, 0, 0);
317 layout
.StartRow(0, 0);
321 host
.SetBounds(0, 0, 110, 20);
322 layout
.Layout(&host
);
323 ExpectViewBoundsEquals(0, 0, 100, 20, &v1
);
324 ExpectViewBoundsEquals(100, 0, 10, 10, &v2
);
329 TEST_F(GridLayoutTest
, HorizontalResizeTest2
) {
330 SettableSizeView
v1(gfx::Size(50, 20));
331 SettableSizeView
v2(gfx::Size(10, 10));
332 ColumnSet
* c1
= layout
.AddColumnSet(0);
333 c1
->AddColumn(GridLayout::FILL
, GridLayout::LEADING
,
334 1, GridLayout::USE_PREF
, 0, 0);
335 c1
->AddColumn(GridLayout::TRAILING
, GridLayout::LEADING
,
336 1, GridLayout::USE_PREF
, 0, 0);
337 layout
.StartRow(0, 0);
341 host
.SetBounds(0, 0, 120, 20);
342 layout
.Layout(&host
);
343 ExpectViewBoundsEquals(0, 0, 80, 20, &v1
);
344 ExpectViewBoundsEquals(110, 0, 10, 10, &v2
);
349 // Tests that space leftover due to rounding is distributed to the last
351 TEST_F(GridLayoutTest
, HorizontalResizeTest3
) {
352 SettableSizeView
v1(gfx::Size(10, 10));
353 SettableSizeView
v2(gfx::Size(10, 10));
354 SettableSizeView
v3(gfx::Size(10, 10));
355 ColumnSet
* c1
= layout
.AddColumnSet(0);
356 c1
->AddColumn(GridLayout::FILL
, GridLayout::LEADING
,
357 1, GridLayout::USE_PREF
, 0, 0);
358 c1
->AddColumn(GridLayout::FILL
, GridLayout::LEADING
,
359 1, GridLayout::USE_PREF
, 0, 0);
360 c1
->AddColumn(GridLayout::TRAILING
, GridLayout::LEADING
,
361 0, GridLayout::USE_PREF
, 0, 0);
362 layout
.StartRow(0, 0);
367 host
.SetBounds(0, 0, 31, 10);
368 layout
.Layout(&host
);
369 ExpectViewBoundsEquals(0, 0, 10, 10, &v1
);
370 ExpectViewBoundsEquals(10, 0, 11, 10, &v2
);
371 ExpectViewBoundsEquals(21, 0, 10, 10, &v3
);
376 TEST_F(GridLayoutTest
, TestVerticalResize1
) {
377 SettableSizeView
v1(gfx::Size(50, 20));
378 SettableSizeView
v2(gfx::Size(10, 10));
379 ColumnSet
* c1
= layout
.AddColumnSet(0);
380 c1
->AddColumn(GridLayout::FILL
, GridLayout::FILL
,
381 1, GridLayout::USE_PREF
, 0, 0);
382 layout
.StartRow(1, 0);
384 layout
.StartRow(0, 0);
388 EXPECT_EQ(gfx::Size(50, 30), pref
);
390 host
.SetBounds(0, 0, 50, 100);
391 layout
.Layout(&host
);
392 ExpectViewBoundsEquals(0, 0, 50, 90, &v1
);
393 ExpectViewBoundsEquals(0, 90, 50, 10, &v2
);
398 TEST_F(GridLayoutTest
, Insets
) {
399 SettableSizeView
v1(gfx::Size(10, 20));
400 ColumnSet
* c1
= layout
.AddColumnSet(0);
401 layout
.SetInsets(1, 2, 3, 4);
402 c1
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
403 0, GridLayout::USE_PREF
, 0, 0);
404 layout
.StartRow(0, 0);
408 EXPECT_EQ(gfx::Size(16, 24), pref
);
410 host
.SetBounds(0, 0, pref
.width(), pref
.height());
411 layout
.Layout(&host
);
412 ExpectViewBoundsEquals(2, 1, 10, 20, &v1
);
417 TEST_F(GridLayoutTest
, FixedSize
) {
418 layout
.SetInsets(2, 2, 2, 2);
420 ColumnSet
* set
= layout
.AddColumnSet(0);
422 int column_count
= 4;
423 int title_width
= 100;
426 int pref_height
= 20;
428 for (int i
= 0; i
< column_count
; ++i
) {
429 set
->AddColumn(GridLayout::CENTER
,
437 for (int row
= 0; row
< row_count
; ++row
) {
438 layout
.StartRow(0, 0);
439 for (int col
= 0; col
< column_count
; ++col
) {
440 layout
.AddView(new SettableSizeView(gfx::Size(pref_width
, pref_height
)));
444 layout
.Layout(&host
);
446 for (int i
= 0; i
< column_count
; ++i
) {
447 for (int row
= 0; row
< row_count
; ++row
) {
448 View
* view
= host
.child_at(row
* column_count
+ i
);
449 ExpectViewBoundsEquals(
450 2 + title_width
* i
+ (title_width
- pref_width
) / 2,
451 2 + pref_height
* row
,
458 EXPECT_EQ(gfx::Size(column_count
* title_width
+ 4,
459 row_count
* pref_height
+ 4), pref
);
462 TEST_F(GridLayoutTest
, RowSpanWithPaddingRow
) {
463 ColumnSet
* set
= layout
.AddColumnSet(0);
465 set
->AddColumn(GridLayout::CENTER
,
472 layout
.StartRow(0, 0);
473 layout
.AddView(new SettableSizeView(gfx::Size(10, 10)), 1, 2);
474 layout
.AddPaddingRow(0, 10);
477 TEST_F(GridLayoutTest
, RowSpan
) {
478 ColumnSet
* set
= layout
.AddColumnSet(0);
480 set
->AddColumn(GridLayout::LEADING
,
483 GridLayout::USE_PREF
,
486 set
->AddColumn(GridLayout::LEADING
,
489 GridLayout::USE_PREF
,
493 layout
.StartRow(0, 0);
494 layout
.AddView(new SettableSizeView(gfx::Size(20, 10)));
495 layout
.AddView(new SettableSizeView(gfx::Size(20, 40)), 1, 2);
496 layout
.StartRow(1, 0);
497 View
* s3
= new SettableSizeView(gfx::Size(20, 10));
501 EXPECT_EQ(gfx::Size(40, 40), pref
);
503 host
.SetBounds(0, 0, pref
.width(), pref
.height());
504 layout
.Layout(&host
);
505 ExpectViewBoundsEquals(0, 10, 20, 10, s3
);
508 TEST_F(GridLayoutTest
, RowSpan2
) {
509 ColumnSet
* set
= layout
.AddColumnSet(0);
511 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
512 0, GridLayout::USE_PREF
, 0, 0);
513 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
514 0,GridLayout::USE_PREF
, 0, 0);
516 layout
.StartRow(0, 0);
517 layout
.AddView(new SettableSizeView(gfx::Size(20, 20)));
518 View
* s3
= new SettableSizeView(gfx::Size(64, 64));
519 layout
.AddView(s3
, 1, 3);
521 layout
.AddPaddingRow(0, 10);
523 layout
.StartRow(0, 0);
524 layout
.AddView(new SettableSizeView(gfx::Size(10, 20)));
527 EXPECT_EQ(gfx::Size(84, 64), pref
);
529 host
.SetBounds(0, 0, pref
.width(), pref
.height());
530 layout
.Layout(&host
);
531 ExpectViewBoundsEquals(20, 0, 64, 64, s3
);
534 TEST_F(GridLayoutTest
, FixedViewWidth
) {
535 ColumnSet
* set
= layout
.AddColumnSet(0);
537 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
538 0, GridLayout::USE_PREF
, 0, 0);
539 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
540 0,GridLayout::USE_PREF
, 0, 0);
542 layout
.StartRow(0, 0);
543 View
* view
= new SettableSizeView(gfx::Size(30, 40));
544 layout
.AddView(view
, 1, 1, GridLayout::LEADING
, GridLayout::LEADING
, 10, 0);
547 EXPECT_EQ(10, pref
.width());
548 EXPECT_EQ(40, pref
.height());
550 host
.SetBounds(0, 0, pref
.width(), pref
.height());
551 layout
.Layout(&host
);
552 ExpectViewBoundsEquals(0, 0, 10, 40, view
);
555 TEST_F(GridLayoutTest
, FixedViewHeight
) {
556 ColumnSet
* set
= layout
.AddColumnSet(0);
558 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
559 0, GridLayout::USE_PREF
, 0, 0);
560 set
->AddColumn(GridLayout::LEADING
, GridLayout::LEADING
,
561 0,GridLayout::USE_PREF
, 0, 0);
563 layout
.StartRow(0, 0);
564 View
* view
= new SettableSizeView(gfx::Size(30, 40));
565 layout
.AddView(view
, 1, 1, GridLayout::LEADING
, GridLayout::LEADING
, 0, 10);
568 EXPECT_EQ(30, pref
.width());
569 EXPECT_EQ(10, pref
.height());
571 host
.SetBounds(0, 0, pref
.width(), pref
.height());
572 layout
.Layout(&host
);
573 ExpectViewBoundsEquals(0, 0, 30, 10, view
);
576 // Make sure that for views that span columns the underlying columns are resized
577 // based on the resize percent of the column.
578 TEST_F(GridLayoutTest
, ColumnSpanResizing
) {
579 ColumnSet
* set
= layout
.AddColumnSet(0);
581 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
582 2, GridLayout::USE_PREF
, 0, 0);
583 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
584 4, GridLayout::USE_PREF
, 0, 0);
586 layout
.StartRow(0, 0);
587 // span_view spans two columns and is twice as big the views added below.
588 View
* span_view
= new SettableSizeView(gfx::Size(12, 40));
589 layout
.AddView(span_view
, 2, 1, GridLayout::LEADING
, GridLayout::LEADING
);
591 layout
.StartRow(0, 0);
592 View
* view1
= new SettableSizeView(gfx::Size(2, 40));
593 View
* view2
= new SettableSizeView(gfx::Size(4, 40));
594 layout
.AddView(view1
);
595 layout
.AddView(view2
);
597 host
.SetBounds(0, 0, 12, 80);
598 layout
.Layout(&host
);
600 ExpectViewBoundsEquals(0, 0, 12, 40, span_view
);
602 // view1 should be 4 pixels wide
603 // column_pref + (remaining_width * column_resize / total_column_resize) =
605 ExpectViewBoundsEquals(0, 40, 4, 40, view1
);
607 // And view2 should be 8 pixels wide:
609 ExpectViewBoundsEquals(4, 40, 8, 40, view2
);
612 // Check that GetPreferredSize() takes resizing of columns into account when
613 // there is additional space in the case we have column sets of different
615 TEST_F(GridLayoutTest
, ColumnResizingOnGetPreferredSize
) {
616 ColumnSet
* set
= layout
.AddColumnSet(0);
617 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
618 1, GridLayout::USE_PREF
, 0, 0);
620 set
= layout
.AddColumnSet(1);
621 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
622 1, GridLayout::USE_PREF
, 0, 0);
624 set
= layout
.AddColumnSet(2);
625 set
->AddColumn(GridLayout::FILL
, GridLayout::CENTER
,
626 1, GridLayout::USE_PREF
, 0, 0);
628 // Make a row containing a flexible view that trades width for height.
629 layout
.StartRow(0, 0);
630 View
* view1
= new FlexibleView(100);
631 layout
.AddView(view1
, 1, 1, GridLayout::FILL
, GridLayout::LEADING
);
633 // The second row contains a view of fixed size that will enforce a column
634 // width of 20 pixels.
635 layout
.StartRow(0, 1);
636 View
* view2
= new SettableSizeView(gfx::Size(20, 20));
637 layout
.AddView(view2
, 1, 1, GridLayout::FILL
, GridLayout::LEADING
);
639 // Add another flexible view in row three in order to ensure column set
640 // ordering doesn't influence sizing behaviour.
641 layout
.StartRow(0, 2);
642 View
* view3
= new FlexibleView(40);
643 layout
.AddView(view3
, 1, 1, GridLayout::FILL
, GridLayout::LEADING
);
645 // We expect a height of 50: 30 from the variable width view in the first row
646 // plus 20 from the statically sized view in the second row. The flexible
647 // view in the third row should contribute no height.
648 EXPECT_EQ(gfx::Size(20, 50), layout
.GetPreferredSize(&host
));
651 TEST_F(GridLayoutTest
, MinimumPreferredSize
) {
652 SettableSizeView
v1(gfx::Size(10, 20));
653 ColumnSet
* set
= layout
.AddColumnSet(0);
654 set
->AddColumn(GridLayout::FILL
, GridLayout::FILL
,
655 0, GridLayout::USE_PREF
, 0, 0);
656 layout
.StartRow(0, 0);
660 EXPECT_EQ(gfx::Size(10, 20), pref
);
662 layout
.set_minimum_size(gfx::Size(40, 40));
664 EXPECT_EQ(gfx::Size(40, 40), pref
);