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.
5 #include "cc/resources/layer_quad.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/quad_f.h"
13 TEST(LayerQuadTest
, QuadFConversion
) {
14 gfx::PointF
p1(-0.5f
, -0.5f
);
15 gfx::PointF
p2(0.5f
, -0.5f
);
16 gfx::PointF
p3(0.5f
, 0.5f
);
17 gfx::PointF
p4(-0.5f
, 0.5f
);
19 gfx::QuadF
quad_cw(p1
, p2
, p3
, p4
);
20 LayerQuad
layer_quad_cw(quad_cw
);
21 EXPECT_EQ(layer_quad_cw
.ToQuadF(), quad_cw
);
23 gfx::QuadF
quad_ccw(p1
, p4
, p3
, p2
);
24 LayerQuad
layer_quad_ccw(quad_ccw
);
25 EXPECT_EQ(layer_quad_ccw
.ToQuadF(), quad_ccw
);
28 TEST(LayerQuadTest
, Inflate
) {
29 gfx::PointF
p1(-0.5f
, -0.5f
);
30 gfx::PointF
p2(0.5f
, -0.5f
);
31 gfx::PointF
p3(0.5f
, 0.5f
);
32 gfx::PointF
p4(-0.5f
, 0.5f
);
34 gfx::QuadF
quad(p1
, p2
, p3
, p4
);
35 LayerQuad
layer_quad(quad
);
37 layer_quad
.Inflate(0.5f
);
38 EXPECT_EQ(layer_quad
.ToQuadF(), quad
);