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

Side by Side Diff: cc/solid_color_layer_impl_unittest.cc

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 6
7 #include "CCSolidColorLayerImpl.h" 7 #include "CCSolidColorLayerImpl.h"
8 8
9 #include "CCAppendQuadsData.h" 9 #include "CCAppendQuadsData.h"
10 #include "CCSingleThreadProxy.h" 10 #include "CCSingleThreadProxy.h"
11 #include "CCSolidColorDrawQuad.h" 11 #include "CCSolidColorDrawQuad.h"
12 #include "cc/test/layer_test_common.h" 12 #include "cc/test/layer_test_common.h"
13 #include "cc/test/mock_quad_culler.h" 13 #include "cc/test/mock_quad_culler.h"
14 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 using namespace cc; 17 using namespace cc;
18 using namespace CCLayerTestCommon; 18 using namespace LayerTestCommon;
19 19
20 namespace { 20 namespace {
21 21
22 TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) 22 TEST(SolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap)
23 { 23 {
24 DebugScopedSetImplThread scopedImplThread; 24 DebugScopedSetImplThread scopedImplThread;
25 25
26 MockCCQuadCuller quadCuller; 26 MockQuadCuller quadCuller;
27 IntSize layerSize = IntSize(800, 600); 27 IntSize layerSize = IntSize(800, 600);
28 IntRect visibleContentRect = IntRect(IntPoint(), layerSize); 28 IntRect visibleContentRect = IntRect(IntPoint(), layerSize);
29 29
30 scoped_ptr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); 30 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
31 layer->setVisibleContentRect(visibleContentRect); 31 layer->setVisibleContentRect(visibleContentRect);
32 layer->setBounds(layerSize); 32 layer->setBounds(layerSize);
33 layer->setContentBounds(layerSize); 33 layer->setContentBounds(layerSize);
34 layer->createRenderSurface(); 34 layer->createRenderSurface();
35 layer->setRenderTarget(layer.get()); 35 layer->setRenderTarget(layer.get());
36 36
37 CCAppendQuadsData data; 37 AppendQuadsData data;
38 layer->appendQuads(quadCuller, data); 38 layer->appendQuads(quadCuller, data);
39 39
40 verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); 40 verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect);
41 } 41 }
42 42
43 TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) 43 TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad)
44 { 44 {
45 DebugScopedSetImplThread scopedImplThread; 45 DebugScopedSetImplThread scopedImplThread;
46 46
47 SkColor testColor = 0xFFA55AFF; 47 SkColor testColor = 0xFFA55AFF;
48 48
49 MockCCQuadCuller quadCuller; 49 MockQuadCuller quadCuller;
50 IntSize layerSize = IntSize(100, 100); 50 IntSize layerSize = IntSize(100, 100);
51 IntRect visibleContentRect = IntRect(IntPoint(), layerSize); 51 IntRect visibleContentRect = IntRect(IntPoint(), layerSize);
52 52
53 scoped_ptr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); 53 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
54 layer->setVisibleContentRect(visibleContentRect); 54 layer->setVisibleContentRect(visibleContentRect);
55 layer->setBounds(layerSize); 55 layer->setBounds(layerSize);
56 layer->setContentBounds(layerSize); 56 layer->setContentBounds(layerSize);
57 layer->setBackgroundColor(testColor); 57 layer->setBackgroundColor(testColor);
58 layer->createRenderSurface(); 58 layer->createRenderSurface();
59 layer->setRenderTarget(layer.get()); 59 layer->setRenderTarget(layer.get());
60 60
61 CCAppendQuadsData data; 61 AppendQuadsData data;
62 layer->appendQuads(quadCuller, data); 62 layer->appendQuads(quadCuller, data);
63 63
64 ASSERT_EQ(quadCuller.quadList().size(), 1U); 64 ASSERT_EQ(quadCuller.quadList().size(), 1U);
65 EXPECT_EQ(CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->colo r(), testColor); 65 EXPECT_EQ(SolidColorDrawQuad::materialCast(quadCuller.quadList()[0])->color( ), testColor);
66 } 66 }
67 67
68 TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) 68 TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad)
69 { 69 {
70 DebugScopedSetImplThread scopedImplThread; 70 DebugScopedSetImplThread scopedImplThread;
71 71
72 const float opacity = 0.5f; 72 const float opacity = 0.5f;
73 73
74 MockCCQuadCuller quadCuller; 74 MockQuadCuller quadCuller;
75 IntSize layerSize = IntSize(100, 100); 75 IntSize layerSize = IntSize(100, 100);
76 IntRect visibleContentRect = IntRect(IntPoint(), layerSize); 76 IntRect visibleContentRect = IntRect(IntPoint(), layerSize);
77 77
78 scoped_ptr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); 78 scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::create(1);
79 layer->setVisibleContentRect(visibleContentRect); 79 layer->setVisibleContentRect(visibleContentRect);
80 layer->setBounds(layerSize); 80 layer->setBounds(layerSize);
81 layer->setContentBounds(layerSize); 81 layer->setContentBounds(layerSize);
82 layer->setDrawOpacity(opacity); 82 layer->setDrawOpacity(opacity);
83 layer->createRenderSurface(); 83 layer->createRenderSurface();
84 layer->setRenderTarget(layer.get()); 84 layer->setRenderTarget(layer.get());
85 85
86 CCAppendQuadsData data; 86 AppendQuadsData data;
87 layer->appendQuads(quadCuller, data); 87 layer->appendQuads(quadCuller, data);
88 88
89 ASSERT_EQ(quadCuller.quadList().size(), 1U); 89 ASSERT_EQ(quadCuller.quadList().size(), 1U);
90 EXPECT_EQ(opacity, CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[ 0])->opacity()); 90 EXPECT_EQ(opacity, SolidColorDrawQuad::materialCast(quadCuller.quadList()[0] )->opacity());
91 } 91 }
92 92
93 } // namespace 93 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698