| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/grid_layout.h" | 5 #include "chrome/views/grid_layout.h" |
| 6 #include "chrome/views/view.h" | 6 #include "chrome/views/view.h" |
| 7 | 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 using views::ColumnSet; | 10 using views::ColumnSet; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 for (int col = 0; col < column_count; ++col) { | 380 for (int col = 0; col < column_count; ++col) { |
| 381 layout->AddView(new SettableSizeView(gfx::Size(pref_width, pref_height))); | 381 layout->AddView(new SettableSizeView(gfx::Size(pref_width, pref_height))); |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 | 384 |
| 385 layout->Layout(&host); | 385 layout->Layout(&host); |
| 386 | 386 |
| 387 for (int i = 0; i < column_count; ++i) { | 387 for (int i = 0; i < column_count; ++i) { |
| 388 for (int row = 0; row < row_count; ++row) { | 388 for (int row = 0; row < row_count; ++row) { |
| 389 View* view = host.GetChildViewAt(row * column_count + i); | 389 View* view = host.GetChildViewAt(row * column_count + i); |
| 390 ExpectViewBoundsEquals(2 + title_width * i + (title_width - pref_width) /
2, | 390 ExpectViewBoundsEquals( |
| 391 2 + pref_height * row, | 391 2 + title_width * i + (title_width - pref_width) / 2, |
| 392 pref_width, pref_height, view); | 392 2 + pref_height * row, |
| 393 pref_width, |
| 394 pref_height, view); |
| 393 } | 395 } |
| 394 } | 396 } |
| 395 | 397 |
| 396 GetPreferredSize(); | 398 GetPreferredSize(); |
| 397 EXPECT_TRUE(gfx::Size(column_count * title_width + 4, | 399 EXPECT_TRUE(gfx::Size(column_count * title_width + 4, |
| 398 row_count * pref_height + 4) == pref); | 400 row_count * pref_height + 4) == pref); |
| 399 } | 401 } |
| 400 | 402 |
| 401 TEST_F(GridLayoutTest, RowSpanWithPaddingRow) { | 403 TEST_F(GridLayoutTest, RowSpanWithPaddingRow) { |
| 402 views::ColumnSet* set = layout->AddColumnSet(0); | 404 views::ColumnSet* set = layout->AddColumnSet(0); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 507 |
| 506 GetPreferredSize(); | 508 GetPreferredSize(); |
| 507 EXPECT_EQ(30, pref.width()); | 509 EXPECT_EQ(30, pref.width()); |
| 508 EXPECT_EQ(10, pref.height()); | 510 EXPECT_EQ(10, pref.height()); |
| 509 | 511 |
| 510 host.SetBounds(0, 0, pref.width(), pref.height()); | 512 host.SetBounds(0, 0, pref.width(), pref.height()); |
| 511 layout->Layout(&host); | 513 layout->Layout(&host); |
| 512 ExpectViewBoundsEquals(0, 0, 30, 10, view); | 514 ExpectViewBoundsEquals(0, 0, 30, 10, view); |
| 513 } | 515 } |
| 514 | 516 |
| OLD | NEW |