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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1132253003: Observe LCD text restrictions during layer animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: contents_opaque + animation unit test Created 5 years, 7 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 | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index bcd437f9cbb87274e5f846e1dc7b342bf6b09f2b..591f48c43295c82059076b4a6a8cc86656a386dc 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -5977,6 +5977,7 @@ TEST_P(LCDTextTest, CanUseLCDText) {
TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) {
bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_;
+ bool expect_not_lcd_text = layers_always_allowed_lcd_text_;
// Sanity check: Make sure can_use_lcd_text_ is set on each node.
ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
@@ -5992,11 +5993,34 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) {
ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
layers_always_allowed_lcd_text_);
- // Text AA should not be adjusted while animation is active.
- // Make sure LCD text AA setting remains unchanged.
+ // Text LCD should be adjusted while animation is active.
+ EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
+ EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
+ EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
+}
+
+TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) {
+ bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_;
+ bool expect_not_lcd_text = layers_always_allowed_lcd_text_;
+
+ // Sanity check: Make sure can_use_lcd_text_ is set on each node.
+ ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
+ layers_always_allowed_lcd_text_);
EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
+
+ // Mark contents non-opaque within the first animation frame.
+ child_->SetContentsOpaque(false);
+ AddOpacityTransitionToController(child_->layer_animation_controller(), 10.0,
+ 0.9f, 0.1f, false);
+
+ ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
+ layers_always_allowed_lcd_text_);
+ // LCD text should be disabled for non-opaque layers even during animations.
+ EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
+ EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
+ EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
}
INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698