add a use_alsa gyp setting
[chromium-blink-merge.git] / cc / render_pass_unittest.cc
blobfdf314c98c5a9eab561de75709bc4d77e1673164
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
3 // found in the LICENSE file.
5 #include "cc/render_pass.h"
7 #include "cc/checkerboard_draw_quad.h"
8 #include "cc/math_util.h"
9 #include "cc/test/geometry_test_utils.h"
10 #include "cc/test/render_pass_test_common.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations.h"
13 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
14 #include "ui/gfx/transform.h"
16 using cc::TestRenderPass;
18 namespace cc {
19 namespace {
21 struct RenderPassSize {
22 // If you add a new field to this class, make sure to add it to the copy() tests.
23 RenderPass::Id m_id;
24 QuadList m_quadList;
25 SharedQuadStateList m_sharedQuadStateList;
26 gfx::Transform m_transformToRootTarget;
27 gfx::Rect m_outputRect;
28 gfx::RectF m_damageRect;
29 bool m_hasTransparentBackground;
30 bool m_hasOcclusionFromOutsideTargetSurface;
33 TEST(RenderPassTest, copyShouldBeIdenticalExceptIdAndQuads)
35 RenderPass::Id id(3, 2);
36 gfx::Rect outputRect(45, 22, 120, 13);
37 gfx::Transform transformToRoot = gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0);
38 gfx::Rect damageRect(56, 123, 19, 43);
39 bool hasTransparentBackground = true;
40 bool hasOcclusionFromOutsideTargetSurface = true;
42 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create();
43 pass->SetAll(id,
44 outputRect,
45 damageRect,
46 transformToRoot,
47 hasTransparentBackground,
48 hasOcclusionFromOutsideTargetSurface);
50 // Stick a quad in the pass, this should not get copied.
51 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create();
52 sharedState->SetAll(gfx::Transform(), gfx::Rect(), gfx::Rect(), false, 1);
53 pass->AppendSharedQuadState(sharedState.Pass());
55 scoped_ptr<CheckerboardDrawQuad> checkerboardQuad = CheckerboardDrawQuad::Create();
56 checkerboardQuad->SetNew(pass->shared_quad_state_list.back(), gfx::Rect(), SkColor());
57 pass->quad_list.push_back(checkerboardQuad.PassAs<DrawQuad>());
59 RenderPass::Id newId(63, 4);
61 scoped_ptr<RenderPass> copy = pass->Copy(newId);
62 EXPECT_EQ(newId, copy->id);
63 EXPECT_RECT_EQ(pass->output_rect, copy->output_rect);
64 EXPECT_EQ(pass->transform_to_root_target, copy->transform_to_root_target);
65 EXPECT_RECT_EQ(pass->damage_rect, copy->damage_rect);
66 EXPECT_EQ(pass->has_transparent_background, copy->has_transparent_background);
67 EXPECT_EQ(pass->has_occlusion_from_outside_target_surface, copy->has_occlusion_from_outside_target_surface);
68 EXPECT_EQ(0u, copy->quad_list.size());
70 EXPECT_EQ(sizeof(RenderPassSize), sizeof(RenderPass));
73 } // namespace
74 } // namespace cc