Chromium Code Reviews| Index: ui/views/view_unittest.cc |
| diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc |
| index 85c2f4896490ff6c8e2a7d1b75868be524bcdb99..01118f02f073adef41b160593dc315686b7264a5 100644 |
| --- a/ui/views/view_unittest.cc |
| +++ b/ui/views/view_unittest.cc |
| @@ -2932,9 +2932,22 @@ TEST_F(ViewLayerTest, BoundInRTL) { |
| v2->layer()->bounds()); |
| gfx::Rect l2bounds = v2->layer()->bounds(); |
| + // Now attach a paints-to-layer View as a child view of |v1|. |
|
sky
2015/01/08 22:05:02
Please write a new test for covering new functiona
Matt Giuca
2015/01/09 03:28:05
Done, and added a bunch of new asserts to the new
|
| + View* v3 = new View; |
| + v3->SetPaintToLayer(true); |
| + v3->SetBounds(3, 5, 6, 4); |
| + EXPECT_EQ(gfx::Rect(3, 5, 6, 4), |
| + v3->layer()->bounds()); |
| + v1->AddChildView(v3); |
| + // Check that |v3| now has RTL-appropriate bounds. |
| + EXPECT_EQ(gfx::Rect(11, 5, 6, 4), |
| + v3->layer()->bounds()); |
| + gfx::Rect l3bounds = v3->layer()->bounds(); |
| + |
| view->SetPaintToLayer(true); |
| EXPECT_EQ(l1bounds, v1->layer()->bounds()); |
| EXPECT_EQ(l2bounds, v2->layer()->bounds()); |
| + EXPECT_EQ(l3bounds, v3->layer()->bounds()); |
| // Move one of the views. Make sure the layer is positioned correctly |
| // afterwards. |
| @@ -2945,12 +2958,19 @@ TEST_F(ViewLayerTest, BoundInRTL) { |
| view->SetPaintToLayer(false); |
| EXPECT_EQ(l1bounds, v1->layer()->bounds()); |
| EXPECT_EQ(l2bounds, v2->layer()->bounds()); |
| + EXPECT_EQ(l3bounds, v3->layer()->bounds()); |
| // Move a view again. |
| v2->SetBounds(v2->x() + 5, v2->y(), v2->width(), v2->height()); |
| l2bounds.set_x(l2bounds.x() - 5); |
| EXPECT_EQ(l2bounds, v2->layer()->bounds()); |
| + // Resize |v1|. Make sure that |v3|'s layer has been moved correctly to |
| + // RTL-appropriate bounds. |
| + v1->SetSize(gfx::Size(30, 10)); |
| + EXPECT_EQ(gfx::Rect(21, 5, 6, 4), |
| + v3->layer()->bounds()); |
| + |
| // Reset locale. |
| base::i18n::SetICUDefaultLocale(locale); |
| } |