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

Side by Side Diff: cc/solid_color_layer_impl_unittest.cc

Issue 11411050: cc: Make the DrawQuad subclasses into struct-like classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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/solid_color_layer_impl.cc ('k') | cc/stream_video_draw_quad.h » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/solid_color_layer_impl.h" 5 #include "cc/solid_color_layer_impl.h"
6 6
7 #include "cc/append_quads_data.h" 7 #include "cc/append_quads_data.h"
8 #include "cc/single_thread_proxy.h" 8 #include "cc/single_thread_proxy.h"
9 #include "cc/solid_color_draw_quad.h" 9 #include "cc/solid_color_draw_quad.h"
10 #include "cc/solid_color_layer.h" 10 #include "cc/solid_color_layer.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 layer->setBounds(layerSize); 50 layer->setBounds(layerSize);
51 layer->setContentBounds(layerSize); 51 layer->setContentBounds(layerSize);
52 layer->setBackgroundColor(testColor); 52 layer->setBackgroundColor(testColor);
53 layer->createRenderSurface(); 53 layer->createRenderSurface();
54 layer->setRenderTarget(layer.get()); 54 layer->setRenderTarget(layer.get());
55 55
56 AppendQuadsData data; 56 AppendQuadsData data;
57 layer->appendQuads(quadCuller, data); 57 layer->appendQuads(quadCuller, data);
58 58
59 ASSERT_EQ(quadCuller.quadList().size(), 1U); 59 ASSERT_EQ(quadCuller.quadList().size(), 1U);
60 EXPECT_EQ(SolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->color( ), testColor); 60 EXPECT_EQ(SolidColorDrawQuad::MaterialCast(quadCuller.quadList()[0])->color, testColor);
61 } 61 }
62 62
63 TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad) 63 TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad)
64 { 64 {
65 const float opacity = 0.5f; 65 const float opacity = 0.5f;
66 66
67 MockQuadCuller quadCuller; 67 MockQuadCuller quadCuller;
68 gfx::Size layerSize = gfx::Size(100, 100); 68 gfx::Size layerSize = gfx::Size(100, 100);
69 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); 69 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize);
70 70
71 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1); 71 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
72 layer->setVisibleContentRect(visibleContentRect); 72 layer->setVisibleContentRect(visibleContentRect);
73 layer->setBounds(layerSize); 73 layer->setBounds(layerSize);
74 layer->setContentBounds(layerSize); 74 layer->setContentBounds(layerSize);
75 layer->setDrawOpacity(opacity); 75 layer->setDrawOpacity(opacity);
76 layer->createRenderSurface(); 76 layer->createRenderSurface();
77 layer->setRenderTarget(layer.get()); 77 layer->setRenderTarget(layer.get());
78 78
79 AppendQuadsData data; 79 AppendQuadsData data;
80 layer->appendQuads(quadCuller, data); 80 layer->appendQuads(quadCuller, data);
81 81
82 ASSERT_EQ(quadCuller.quadList().size(), 1U); 82 ASSERT_EQ(quadCuller.quadList().size(), 1U);
83 EXPECT_EQ(opacity, SolidColorDrawQuad::materialCast(quadCuller.quadList()[0] )->opacity()); 83 EXPECT_EQ(opacity, SolidColorDrawQuad::MaterialCast(quadCuller.quadList()[0] )->opacity());
84 } 84 }
85 85
86 TEST(SolidColorLayerImplTest, verifyOpaqueRect) 86 TEST(SolidColorLayerImplTest, verifyOpaqueRect)
87 { 87 {
88 scoped_refptr<SolidColorLayer> layer = SolidColorLayer::create(); 88 scoped_refptr<SolidColorLayer> layer = SolidColorLayer::create();
89 gfx::Size layerSize = gfx::Size(100, 100); 89 gfx::Size layerSize = gfx::Size(100, 100);
90 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize); 90 gfx::Rect visibleContentRect = gfx::Rect(gfx::Point(), layerSize);
91 91
92 layer->setVisibleContentRect(visibleContentRect); 92 layer->setVisibleContentRect(visibleContentRect);
93 layer->setBounds(layerSize); 93 layer->setBounds(layerSize);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 AppendQuadsData data; 134 AppendQuadsData data;
135 layerImpl->appendQuads(quadCuller, data); 135 layerImpl->appendQuads(quadCuller, data);
136 136
137 ASSERT_EQ(quadCuller.quadList().size(), 1U); 137 ASSERT_EQ(quadCuller.quadList().size(), 1U);
138 EXPECT_EQ(gfx::Rect().ToString(), quadCuller.quadList()[0]->opaque_rect. ToString()); 138 EXPECT_EQ(gfx::Rect().ToString(), quadCuller.quadList()[0]->opaque_rect. ToString());
139 } 139 }
140 } 140 }
141 141
142 } // namespace 142 } // namespace
143 } // namespace cc 143 } // namespace cc
OLDNEW
« no previous file with comments | « cc/solid_color_layer_impl.cc ('k') | cc/stream_video_draw_quad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698