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

Unified Diff: ui/views/view_unittest.cc

Issue 819273003: View: Resizing a layer in RTL now correctly repositions its children. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« ui/views/view.cc ('K') | « ui/views/view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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|.
+ 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);
}
« ui/views/view.cc ('K') | « ui/views/view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698