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

Side by Side Diff: cc/CCSolidColorLayerImplTest.cpp

Issue 10898023: Update cc snapshot to WK r126941 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebased Created 8 years, 3 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 | « cc/CCSolidColorLayerImpl.cpp ('k') | cc/CCTextureLayerImpl.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 "config.h" 5 #include "config.h"
6 6
7 #include "CCSolidColorLayerImpl.h" 7 #include "CCSolidColorLayerImpl.h"
8 8
9 #include "CCAppendQuadsData.h"
9 #include "CCLayerTestCommon.h" 10 #include "CCLayerTestCommon.h"
10 #include "CCSingleThreadProxy.h" 11 #include "CCSingleThreadProxy.h"
11 #include "CCSolidColorDrawQuad.h" 12 #include "CCSolidColorDrawQuad.h"
12 #include "MockCCQuadCuller.h" 13 #include "MockCCQuadCuller.h"
13 #include <gmock/gmock.h> 14 #include <gmock/gmock.h>
14 #include <gtest/gtest.h> 15 #include <gtest/gtest.h>
15 16
16 using namespace WebCore; 17 using namespace WebCore;
17 using namespace CCLayerTestCommon; 18 using namespace CCLayerTestCommon;
18 19
19 namespace { 20 namespace {
20 21
21 TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) 22 TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap)
22 { 23 {
23 DebugScopedSetImplThread scopedImplThread; 24 DebugScopedSetImplThread scopedImplThread;
24 25
25 MockCCQuadCuller quadCuller; 26 MockCCQuadCuller quadCuller;
26 IntSize layerSize = IntSize(800, 600); 27 IntSize layerSize = IntSize(800, 600);
27 IntRect visibleContentRect = IntRect(IntPoint(), layerSize); 28 IntRect visibleContentRect = IntRect(IntPoint(), layerSize);
28 29
29 OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); 30 OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1);
30 layer->setVisibleContentRect(visibleContentRect); 31 layer->setVisibleContentRect(visibleContentRect);
31 layer->setBounds(layerSize); 32 layer->setBounds(layerSize);
32 layer->setContentBounds(layerSize); 33 layer->setContentBounds(layerSize);
33 layer->createRenderSurface(); 34 layer->createRenderSurface();
34 layer->setRenderTarget(layer.get()); 35 layer->setRenderTarget(layer.get());
35 36
36 bool hadMissingTiles = false; 37 CCAppendQuadsData data;
37 layer->appendQuads(quadCuller, hadMissingTiles); 38 layer->appendQuads(quadCuller, data);
38 39
39 verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); 40 verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect);
40 } 41 }
41 42
42 TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) 43 TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad)
43 { 44 {
44 DebugScopedSetImplThread scopedImplThread; 45 DebugScopedSetImplThread scopedImplThread;
45 46
46 SkColor testColor = 0xFFA55AFF; 47 SkColor testColor = 0xFFA55AFF;
47 48
48 MockCCQuadCuller quadCuller; 49 MockCCQuadCuller quadCuller;
49 IntSize layerSize = IntSize(100, 100); 50 IntSize layerSize = IntSize(100, 100);
50 IntRect visibleContentRect = IntRect(IntPoint(), layerSize); 51 IntRect visibleContentRect = IntRect(IntPoint(), layerSize);
51 52
52 OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); 53 OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1);
53 layer->setVisibleContentRect(visibleContentRect); 54 layer->setVisibleContentRect(visibleContentRect);
54 layer->setBounds(layerSize); 55 layer->setBounds(layerSize);
55 layer->setContentBounds(layerSize); 56 layer->setContentBounds(layerSize);
56 layer->setBackgroundColor(testColor); 57 layer->setBackgroundColor(testColor);
57 layer->createRenderSurface(); 58 layer->createRenderSurface();
58 layer->setRenderTarget(layer.get()); 59 layer->setRenderTarget(layer.get());
59 60
60 bool hadMissingTiles = false; 61 CCAppendQuadsData data;
61 layer->appendQuads(quadCuller, hadMissingTiles); 62 layer->appendQuads(quadCuller, data);
62 63
63 ASSERT_EQ(quadCuller.quadList().size(), 1U); 64 ASSERT_EQ(quadCuller.quadList().size(), 1U);
64 EXPECT_EQ(CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get()) ->color(), testColor); 65 EXPECT_EQ(CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get()) ->color(), testColor);
65 } 66 }
66 67
67 TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) 68 TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad)
68 { 69 {
69 DebugScopedSetImplThread scopedImplThread; 70 DebugScopedSetImplThread scopedImplThread;
70 71
71 const float opacity = 0.5f; 72 const float opacity = 0.5f;
72 73
73 MockCCQuadCuller quadCuller; 74 MockCCQuadCuller quadCuller;
74 IntSize layerSize = IntSize(100, 100); 75 IntSize layerSize = IntSize(100, 100);
75 IntRect visibleContentRect = IntRect(IntPoint(), layerSize); 76 IntRect visibleContentRect = IntRect(IntPoint(), layerSize);
76 77
77 OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); 78 OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1);
78 layer->setVisibleContentRect(visibleContentRect); 79 layer->setVisibleContentRect(visibleContentRect);
79 layer->setBounds(layerSize); 80 layer->setBounds(layerSize);
80 layer->setContentBounds(layerSize); 81 layer->setContentBounds(layerSize);
81 layer->setDrawOpacity(opacity); 82 layer->setDrawOpacity(opacity);
82 layer->createRenderSurface(); 83 layer->createRenderSurface();
83 layer->setRenderTarget(layer.get()); 84 layer->setRenderTarget(layer.get());
84 85
85 bool hadMissingTiles = false; 86 CCAppendQuadsData data;
86 layer->appendQuads(quadCuller, hadMissingTiles); 87 layer->appendQuads(quadCuller, data);
87 88
88 ASSERT_EQ(quadCuller.quadList().size(), 1U); 89 ASSERT_EQ(quadCuller.quadList().size(), 1U);
89 EXPECT_EQ(opacity, CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[ 0].get())->opacity()); 90 EXPECT_EQ(opacity, CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[ 0].get())->opacity());
90 } 91 }
91 92
92 } // namespace 93 } // namespace
OLDNEW
« no previous file with comments | « cc/CCSolidColorLayerImpl.cpp ('k') | cc/CCTextureLayerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698