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

Unified Diff: ui/views/controls/styled_label_unittest.cc

Issue 808853006: Revert "Fixed StyledLabel size caching" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/controls/styled_label.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/styled_label_unittest.cc
diff --git a/ui/views/controls/styled_label_unittest.cc b/ui/views/controls/styled_label_unittest.cc
index c7ccdb69f346ced8593d091559563cd7f73d85b7..8944a4708d6a9223d8857007cb33564dcae90a9c 100644
--- a/ui/views/controls/styled_label_unittest.cc
+++ b/ui/views/controls/styled_label_unittest.cc
@@ -422,48 +422,4 @@ TEST_F(StyledLabelTest, HandleEmptyLayout) {
EXPECT_EQ(0, styled()->child_count());
}
-TEST_F(StyledLabelTest, CacheSize) {
- const int preferred_height = 50;
- const int preferred_width = 100;
- const std::string text("This is a test block of text.");
- const base::string16 another_text(base::ASCIIToUTF16(
- "This is a test block of text. This text is much longer than previous"));
-
- InitStyledLabel(text);
-
- // we should be able to calculate height without any problem
- // no controls should be created
- int precalculated_height = styled()->GetHeightForWidth(preferred_width);
- EXPECT_LT(0, precalculated_height);
- EXPECT_EQ(0, styled()->child_count());
-
- styled()->SetBounds(0, 0, preferred_width, preferred_height);
- styled()->Layout();
-
- // controls should be created after layout
- // height should be the same as precalculated
- int real_height = styled()->GetHeightForWidth(styled()->width());
- View* first_child_after_layout = styled()->has_children() ?
- styled()->child_at(0) : nullptr;
- EXPECT_LT(0, styled()->child_count());
- EXPECT_LT(0, real_height);
- EXPECT_EQ(real_height, precalculated_height);
-
- // another call to Layout should not kill and recreate all controls
- styled()->Layout();
- View* first_child_after_second_layout = styled()->has_children() ?
- styled()->child_at(0) : nullptr;
- EXPECT_EQ(first_child_after_layout, first_child_after_second_layout);
-
- // if text is changed:
- // layout should be recalculated
- // all controls should be recreated
- styled()->SetText(another_text);
- int updated_height = styled()->GetHeightForWidth(styled()->width());
- EXPECT_NE(updated_height, real_height);
- View* first_child_after_text_update = styled()->has_children() ?
- styled()->child_at(0) : nullptr;
- EXPECT_NE(first_child_after_text_update, first_child_after_layout);
-}
-
} // namespace views
« no previous file with comments | « ui/views/controls/styled_label.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698