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

Side by Side Diff: cc/tiled_layer_impl_unittest.cc

Issue 11417035: cc: Switch the DrawQuad enum names to chromium style and remove pragmas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/tile_draw_quad.cc ('k') | cc/yuv_video_draw_quad.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 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/tiled_layer_impl.h" 5 #include "cc/tiled_layer_impl.h"
6 6
7 #include "cc/append_quads_data.h" 7 #include "cc/append_quads_data.h"
8 #include "cc/layer_tiling_data.h" 8 #include "cc/layer_tiling_data.h"
9 #include "cc/single_thread_proxy.h" 9 #include "cc/single_thread_proxy.h"
10 #include "cc/test/layer_test_common.h" 10 #include "cc/test/layer_test_common.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // No checkerboarding 107 // No checkerboarding
108 { 108 {
109 MockQuadCuller quadCuller; 109 MockQuadCuller quadCuller;
110 AppendQuadsData data; 110 AppendQuadsData data;
111 layer->appendQuads(quadCuller, data); 111 layer->appendQuads(quadCuller, data);
112 EXPECT_EQ(quadCuller.quadList().size(), 4u); 112 EXPECT_EQ(quadCuller.quadList().size(), 4u);
113 EXPECT_FALSE(data.hadMissingTiles); 113 EXPECT_FALSE(data.hadMissingTiles);
114 114
115 for (size_t i = 0; i < quadCuller.quadList().size(); ++i) 115 for (size_t i = 0; i < quadCuller.quadList().size(); ++i)
116 EXPECT_EQ(quadCuller.quadList()[i]->material(), DrawQuad::TiledConte nt); 116 EXPECT_EQ(quadCuller.quadList()[i]->material(), DrawQuad::TILED_CONT ENT);
117 } 117 }
118 118
119 for (int i = 0; i < numTilesX; ++i) 119 for (int i = 0; i < numTilesX; ++i)
120 for (int j = 0; j < numTilesY; ++j) 120 for (int j = 0; j < numTilesY; ++j)
121 layer->pushTileProperties(i, j, 0, gfx::Rect(), false); 121 layer->pushTileProperties(i, j, 0, gfx::Rect(), false);
122 122
123 // All checkerboarding 123 // All checkerboarding
124 { 124 {
125 MockQuadCuller quadCuller; 125 MockQuadCuller quadCuller;
126 AppendQuadsData data; 126 AppendQuadsData data;
127 layer->appendQuads(quadCuller, data); 127 layer->appendQuads(quadCuller, data);
128 EXPECT_TRUE(data.hadMissingTiles); 128 EXPECT_TRUE(data.hadMissingTiles);
129 EXPECT_EQ(quadCuller.quadList().size(), 4u); 129 EXPECT_EQ(quadCuller.quadList().size(), 4u);
130 for (size_t i = 0; i < quadCuller.quadList().size(); ++i) 130 for (size_t i = 0; i < quadCuller.quadList().size(); ++i)
131 EXPECT_NE(quadCuller.quadList()[i]->material(), DrawQuad::TiledConte nt); 131 EXPECT_NE(quadCuller.quadList()[i]->material(), DrawQuad::TILED_CONT ENT);
132 } 132 }
133 } 133 }
134 134
135 static void getQuads(QuadList& quads, SharedQuadStateList& sharedStates, gfx::Si ze tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption bord erTexelOption, const gfx::Rect& visibleContentRect) 135 static void getQuads(QuadList& quads, SharedQuadStateList& sharedStates, gfx::Si ze tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption bord erTexelOption, const gfx::Rect& visibleContentRect)
136 { 136 {
137 scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTe xelOption); 137 scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTe xelOption);
138 layer->setVisibleContentRect(visibleContentRect); 138 layer->setVisibleContentRect(visibleContentRect);
139 layer->setBounds(layerSize); 139 layer->setBounds(layerSize);
140 140
141 MockQuadCuller quadCuller(quads, sharedStates); 141 MockQuadCuller quadCuller(quads, sharedStates);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 TEST(TiledLayerImplTest, textureInfoForLayerNoBorders) 193 TEST(TiledLayerImplTest, textureInfoForLayerNoBorders)
194 { 194 {
195 gfx::Size tileSize(50, 50); 195 gfx::Size tileSize(50, 50);
196 gfx::Size layerSize(250, 250); 196 gfx::Size layerSize(250, 250);
197 QuadList quads; 197 QuadList quads;
198 SharedQuadStateList sharedStates; 198 SharedQuadStateList sharedStates;
199 getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorder Texels, gfx::Rect(gfx::Point(), layerSize)); 199 getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorder Texels, gfx::Rect(gfx::Point(), layerSize));
200 200
201 for (size_t i = 0; i < quads.size(); ++i) { 201 for (size_t i = 0; i < quads.size(); ++i) {
202 ASSERT_EQ(quads[i]->material(), DrawQuad::TiledContent) << quadString << i; 202 ASSERT_EQ(quads[i]->material(), DrawQuad::TILED_CONTENT) << quadString < < i;
203 TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]); 203 TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]);
204 204
205 EXPECT_NE(quad->resourceId(), 0u) << quadString << i; 205 EXPECT_NE(quad->resourceId(), 0u) << quadString << i;
206 EXPECT_EQ(quad->textureOffset(), gfx::Vector2d()) << quadString << i; 206 EXPECT_EQ(quad->textureOffset(), gfx::Vector2d()) << quadString << i;
207 EXPECT_EQ(quad->textureSize(), tileSize) << quadString << i; 207 EXPECT_EQ(quad->textureSize(), tileSize) << quadString << i;
208 EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i; 208 EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i;
209 } 209 }
210 } 210 }
211 211
212 TEST(TiledLayerImplTest, tileOpaqueRectForLayerNoBorders) 212 TEST(TiledLayerImplTest, tileOpaqueRectForLayerNoBorders)
213 { 213 {
214 gfx::Size tileSize(50, 50); 214 gfx::Size tileSize(50, 50);
215 gfx::Size layerSize(250, 250); 215 gfx::Size layerSize(250, 250);
216 QuadList quads; 216 QuadList quads;
217 SharedQuadStateList sharedStates; 217 SharedQuadStateList sharedStates;
218 getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorder Texels, gfx::Rect(gfx::Point(), layerSize)); 218 getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorder Texels, gfx::Rect(gfx::Point(), layerSize));
219 219
220 for (size_t i = 0; i < quads.size(); ++i) { 220 for (size_t i = 0; i < quads.size(); ++i) {
221 ASSERT_EQ(quads[i]->material(), DrawQuad::TiledContent) << quadString << i; 221 ASSERT_EQ(quads[i]->material(), DrawQuad::TILED_CONTENT) << quadString < < i;
222 TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]); 222 TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]);
223 223
224 EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i; 224 EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i;
225 } 225 }
226 } 226 }
227 227
228 } // namespace 228 } // namespace
229 } // namespace cc 229 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tile_draw_quad.cc ('k') | cc/yuv_video_draw_quad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698