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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 2921353003: [Merge to M60] Cloning a ui::Layer should also clone its target temperature (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 TEST_F(LayerWithDelegateTest, Cloning) { 726 TEST_F(LayerWithDelegateTest, Cloning) {
727 std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR)); 727 std::unique_ptr<Layer> layer(CreateLayer(LAYER_SOLID_COLOR));
728 728
729 gfx::Transform transform; 729 gfx::Transform transform;
730 transform.Scale(2, 1); 730 transform.Scale(2, 1);
731 transform.Translate(10, 5); 731 transform.Translate(10, 5);
732 732
733 layer->SetTransform(transform); 733 layer->SetTransform(transform);
734 layer->SetColor(SK_ColorRED); 734 layer->SetColor(SK_ColorRED);
735 layer->SetLayerInverted(true); 735 layer->SetLayerInverted(true);
736 const float temperature = 0.8f;
737 layer->SetLayerTemperature(temperature);
736 738
737 auto clone = layer->Clone(); 739 auto clone = layer->Clone();
738 740
739 // Cloning preserves layer state. 741 // Cloning preserves layer state.
740 EXPECT_EQ(transform, clone->GetTargetTransform()); 742 EXPECT_EQ(transform, clone->GetTargetTransform());
741 EXPECT_EQ(SK_ColorRED, clone->background_color()); 743 EXPECT_EQ(SK_ColorRED, clone->background_color());
742 EXPECT_EQ(SK_ColorRED, clone->GetTargetColor()); 744 EXPECT_EQ(SK_ColorRED, clone->GetTargetColor());
743 EXPECT_TRUE(clone->layer_inverted()); 745 EXPECT_TRUE(clone->layer_inverted());
746 EXPECT_FLOAT_EQ(temperature, clone->GetTargetTemperature());
744 747
745 layer->SetTransform(gfx::Transform()); 748 layer->SetTransform(gfx::Transform());
746 layer->SetColor(SK_ColorGREEN); 749 layer->SetColor(SK_ColorGREEN);
747 layer->SetLayerInverted(false); 750 layer->SetLayerInverted(false);
748 751
749 // The clone is an independent copy, so state changes do not propagate. 752 // The clone is an independent copy, so state changes do not propagate.
750 EXPECT_EQ(transform, clone->GetTargetTransform()); 753 EXPECT_EQ(transform, clone->GetTargetTransform());
751 EXPECT_EQ(SK_ColorRED, clone->background_color()); 754 EXPECT_EQ(SK_ColorRED, clone->background_color());
752 EXPECT_EQ(SK_ColorRED, clone->GetTargetColor()); 755 EXPECT_EQ(SK_ColorRED, clone->GetTargetColor());
753 EXPECT_TRUE(clone->layer_inverted()); 756 EXPECT_TRUE(clone->layer_inverted());
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 layer.set_name("foo"); 2246 layer.set_name("foo");
2244 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = 2247 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info =
2245 layer.TakeDebugInfo(nullptr); 2248 layer.TakeDebugInfo(nullptr);
2246 std::string trace_format("bar,"); 2249 std::string trace_format("bar,");
2247 debug_info->AppendAsTraceFormat(&trace_format); 2250 debug_info->AppendAsTraceFormat(&trace_format);
2248 std::string expected("bar,{\"layer_name\":\"foo\"}"); 2251 std::string expected("bar,{\"layer_name\":\"foo\"}");
2249 EXPECT_EQ(expected, trace_format); 2252 EXPECT_EQ(expected, trace_format);
2250 } 2253 }
2251 2254
2252 } // namespace ui 2255 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698