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

Unified Diff: ui/compositor/layer_owner_unittest.cc

Issue 231193002: Makes recreating a layer inherit target visibility and opacity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/compositor/layer_owner.cc ('k') | ui/wm/core/window_animations.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_owner_unittest.cc
diff --git a/ui/compositor/layer_owner_unittest.cc b/ui/compositor/layer_owner_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6390ecaf4633f026c409573114a6defb216f003e
--- /dev/null
+++ b/ui/compositor/layer_owner_unittest.cc
@@ -0,0 +1,33 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/compositor/layer_owner.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/compositor/layer.h"
+#include "ui/compositor/layer_animator.h"
+#include "ui/compositor/scoped_layer_animation_settings.h"
+
+namespace ui {
+
+TEST(LayerOwnerTest, RecreateLayerHonorsTargetVisibilityAndOpacity) {
+ LayerOwner owner;
+ Layer* layer = new Layer;
+ layer->SetVisible(true);
+ layer->SetOpacity(1.0f);
+
+ owner.SetLayer(layer);
+
+ ScopedLayerAnimationSettings settings(layer->GetAnimator());
+ layer->SetVisible(false);
+ layer->SetOpacity(0.0f);
+ EXPECT_TRUE(layer->visible());
+ EXPECT_EQ(1.0f, layer->opacity());
+
+ scoped_ptr<Layer> old_layer(owner.RecreateLayer());
+ EXPECT_FALSE(owner.layer()->visible());
+ EXPECT_EQ(0.0f, owner.layer()->opacity());
+}
+
+} // namespace ui
« no previous file with comments | « ui/compositor/layer_owner.cc ('k') | ui/wm/core/window_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698