blob: 34e79d9894e69d4b26060d5e3c9188ca89668443 [file] [log] [blame]
[email protected]94f206c12012-08-25 00:09:141// 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.
4
[email protected]d50c6862012-10-23 02:08:315#include "cc/layer_quad.h"
[email protected]94f206c12012-08-25 00:09:146
[email protected]7f0c53db2012-10-02 00:23:187#include "testing/gtest/include/gtest/gtest.h"
[email protected]075ae0342012-11-02 20:02:418#include "ui/gfx/quad_f.h"
[email protected]94f206c12012-08-25 00:09:149
[email protected]ba565742012-11-10 09:29:4810namespace cc {
[email protected]94f206c12012-08-25 00:09:1411namespace {
12
[email protected]075ae0342012-11-02 20:02:4113TEST(LayerQuadTest, QuadFConversion)
[email protected]94f206c12012-08-25 00:09:1414{
[email protected]d455d552012-11-02 00:19:0615 gfx::PointF p1(-0.5, -0.5);
16 gfx::PointF p2( 0.5, -0.5);
17 gfx::PointF p3( 0.5, 0.5);
18 gfx::PointF p4(-0.5, 0.5);
[email protected]94f206c12012-08-25 00:09:1419
[email protected]075ae0342012-11-02 20:02:4120 gfx::QuadF quadCW(p1, p2, p3, p4);
[email protected]96baf3e2012-10-22 23:09:5521 LayerQuad layerQuadCW(quadCW);
[email protected]075ae0342012-11-02 20:02:4122 EXPECT_TRUE(layerQuadCW.ToQuadF() == quadCW);
[email protected]94f206c12012-08-25 00:09:1423
[email protected]075ae0342012-11-02 20:02:4124 gfx::QuadF quadCCW(p1, p4, p3, p2);
[email protected]96baf3e2012-10-22 23:09:5525 LayerQuad layerQuadCCW(quadCCW);
[email protected]075ae0342012-11-02 20:02:4126 EXPECT_TRUE(layerQuadCCW.ToQuadF() == quadCCW);
[email protected]94f206c12012-08-25 00:09:1427}
28
[email protected]96baf3e2012-10-22 23:09:5529TEST(LayerQuadTest, Inflate)
[email protected]94f206c12012-08-25 00:09:1430{
[email protected]d455d552012-11-02 00:19:0631 gfx::PointF p1(-0.5, -0.5);
32 gfx::PointF p2( 0.5, -0.5);
33 gfx::PointF p3( 0.5, 0.5);
34 gfx::PointF p4(-0.5, 0.5);
[email protected]94f206c12012-08-25 00:09:1435
[email protected]075ae0342012-11-02 20:02:4136 gfx::QuadF quad(p1, p2, p3, p4);
[email protected]96baf3e2012-10-22 23:09:5537 LayerQuad layerQuad(quad);
[email protected]075ae0342012-11-02 20:02:4138 quad.Scale(2, 2);
[email protected]94f206c12012-08-25 00:09:1439 layerQuad.inflate(0.5);
[email protected]075ae0342012-11-02 20:02:4140 EXPECT_TRUE(layerQuad.ToQuadF() == quad);
[email protected]94f206c12012-08-25 00:09:1441}
42
[email protected]ba565742012-11-10 09:29:4843} // namespace
44} // namespace cc