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

Unified Diff: ui/views/layout/grid_layout_unittest.cc

Issue 185653012: rAc - fix off-by-small-number error in grid layout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « ui/views/layout/grid_layout.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/layout/grid_layout_unittest.cc
diff --git a/ui/views/layout/grid_layout_unittest.cc b/ui/views/layout/grid_layout_unittest.cc
index 71988d870b6366a8b65024302bb21b59394c0837..5a7e0fe0527c6234fe3722bbdd02b7318c43af0e 100644
--- a/ui/views/layout/grid_layout_unittest.cc
+++ b/ui/views/layout/grid_layout_unittest.cc
@@ -346,6 +346,33 @@ TEST_F(GridLayoutTest, HorizontalResizeTest2) {
RemoveAll();
}
+// Tests that space leftover due to rounding is distributed to the last
+// resizable column.
+TEST_F(GridLayoutTest, HorizontalResizeTest3) {
+ SettableSizeView v1(gfx::Size(10, 10));
+ SettableSizeView v2(gfx::Size(10, 10));
+ SettableSizeView v3(gfx::Size(10, 10));
+ ColumnSet* c1 = layout.AddColumnSet(0);
+ c1->AddColumn(GridLayout::FILL, GridLayout::LEADING,
+ 1, GridLayout::USE_PREF, 0, 0);
+ c1->AddColumn(GridLayout::FILL, GridLayout::LEADING,
+ 1, GridLayout::USE_PREF, 0, 0);
+ c1->AddColumn(GridLayout::TRAILING, GridLayout::LEADING,
+ 0, GridLayout::USE_PREF, 0, 0);
+ layout.StartRow(0, 0);
+ layout.AddView(&v1);
+ layout.AddView(&v2);
+ layout.AddView(&v3);
+
+ host.SetBounds(0, 0, 31, 10);
+ layout.Layout(&host);
+ ExpectViewBoundsEquals(0, 0, 10, 10, &v1);
+ ExpectViewBoundsEquals(10, 0, 11, 10, &v2);
+ ExpectViewBoundsEquals(21, 0, 10, 10, &v3);
+
+ RemoveAll();
+}
+
TEST_F(GridLayoutTest, TestVerticalResize1) {
SettableSizeView v1(gfx::Size(50, 20));
SettableSizeView v2(gfx::Size(10, 10));
« no previous file with comments | « ui/views/layout/grid_layout.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698