1 // Copyright 2011 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.
7 #include "cc/layer_quad.h"
9 #include "testing/gtest/include/gtest/gtest.h"
15 TEST(LayerQuadTest
, FloatQuadConversion
)
17 FloatPoint
p1(-0.5, -0.5);
18 FloatPoint
p2( 0.5, -0.5);
19 FloatPoint
p3( 0.5, 0.5);
20 FloatPoint
p4(-0.5, 0.5);
22 FloatQuad
quadCW(p1
, p2
, p3
, p4
);
23 LayerQuad
layerQuadCW(quadCW
);
24 EXPECT_TRUE(layerQuadCW
.floatQuad() == quadCW
);
26 FloatQuad
quadCCW(p1
, p4
, p3
, p2
);
27 LayerQuad
layerQuadCCW(quadCCW
);
28 EXPECT_TRUE(layerQuadCCW
.floatQuad() == quadCCW
);
31 TEST(LayerQuadTest
, Inflate
)
33 FloatPoint
p1(-0.5, -0.5);
34 FloatPoint
p2( 0.5, -0.5);
35 FloatPoint
p3( 0.5, 0.5);
36 FloatPoint
p4(-0.5, 0.5);
38 FloatQuad
quad(p1
, p2
, p3
, p4
);
39 LayerQuad
layerQuad(quad
);
41 layerQuad
.inflate(0.5);
42 EXPECT_TRUE(layerQuad
.floatQuad() == quad
);