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

Side by Side Diff: cc/tree_synchronizer_unittest.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « cc/tiled_layer_unittest.cc ('k') | cc/video_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/tree_synchronizer.h" 7 #include "cc/tree_synchronizer.h"
8 8
9 #include "Region.h" 9 #include "Region.h"
10 #include "cc/layer.h" 10 #include "cc/layer.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 DebugScopedSetImplThread impl; 221 DebugScopedSetImplThread impl;
222 222
223 LayerTreeSettings settings; 223 LayerTreeSettings settings;
224 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); 224 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0);
225 225
226 scoped_refptr<Layer> layerTreeRoot = Layer::create(); 226 scoped_refptr<Layer> layerTreeRoot = Layer::create();
227 layerTreeRoot->addChild(Layer::create()); 227 layerTreeRoot->addChild(Layer::create());
228 layerTreeRoot->addChild(Layer::create()); 228 layerTreeRoot->addChild(Layer::create());
229 229
230 // Pick some random properties to set. The values are not important, we're j ust testing that at least some properties are making it through. 230 // Pick some random properties to set. The values are not important, we're j ust testing that at least some properties are making it through.
231 FloatPoint rootPosition = FloatPoint(2.3f, 7.4f); 231 gfx::PointF rootPosition = gfx::PointF(2.3f, 7.4f);
232 layerTreeRoot->setPosition(rootPosition); 232 layerTreeRoot->setPosition(rootPosition);
233 233
234 float firstChildOpacity = 0.25f; 234 float firstChildOpacity = 0.25f;
235 layerTreeRoot->children()[0]->setOpacity(firstChildOpacity); 235 layerTreeRoot->children()[0]->setOpacity(firstChildOpacity);
236 236
237 IntSize secondChildBounds = IntSize(25, 53); 237 gfx::Size secondChildBounds = gfx::Size(25, 53);
238 layerTreeRoot->children()[1]->setBounds(secondChildBounds); 238 layerTreeRoot->children()[1]->setBounds(secondChildBounds);
239 239
240 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); 240 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
241 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get()); 241 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get());
242 242
243 // Check that the property values we set on the Layer tree are reflected in the LayerImpl tree. 243 // Check that the property values we set on the Layer tree are reflected in the LayerImpl tree.
244 FloatPoint rootLayerImplPosition = layerImplTreeRoot->position(); 244 gfx::PointF rootLayerImplPosition = layerImplTreeRoot->position();
245 EXPECT_EQ(rootPosition.x(), rootLayerImplPosition.x()); 245 EXPECT_EQ(rootPosition.x(), rootLayerImplPosition.x());
246 EXPECT_EQ(rootPosition.y(), rootLayerImplPosition.y()); 246 EXPECT_EQ(rootPosition.y(), rootLayerImplPosition.y());
247 247
248 EXPECT_EQ(firstChildOpacity, layerImplTreeRoot->children()[0]->opacity()); 248 EXPECT_EQ(firstChildOpacity, layerImplTreeRoot->children()[0]->opacity());
249 249
250 IntSize secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bound s(); 250 gfx::Size secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bou nds();
251 EXPECT_EQ(secondChildBounds.width(), secondLayerImplChildBounds.width()); 251 EXPECT_EQ(secondChildBounds.width(), secondLayerImplChildBounds.width());
252 EXPECT_EQ(secondChildBounds.height(), secondLayerImplChildBounds.height()); 252 EXPECT_EQ(secondChildBounds.height(), secondLayerImplChildBounds.height());
253 } 253 }
254 254
255 TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange) 255 TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange)
256 { 256 {
257 DebugScopedSetImplThread impl; 257 DebugScopedSetImplThread impl;
258 std::vector<int> layerImplDestructionList; 258 std::vector<int> layerImplDestructionList;
259 259
260 LayerTreeSettings settings; 260 LayerTreeSettings settings;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 397
398 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer AnimationController())->synchronizedAnimations()); 398 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer AnimationController())->synchronizedAnimations());
399 399
400 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); 400 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
401 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); 401 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get());
402 402
403 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA nimationController())->synchronizedAnimations()); 403 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA nimationController())->synchronizedAnimations());
404 } 404 }
405 405
406 } // namespace 406 } // namespace
OLDNEW
« no previous file with comments | « cc/tiled_layer_unittest.cc ('k') | cc/video_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698