[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 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. |
| 4 | |
[email protected] | d50c686 | 2012-10-23 02:08:31 | [diff] [blame] | 5 | #include "cc/layer_quad.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 6 | |
[email protected] | 7f0c53db | 2012-10-02 00:23:18 | [diff] [blame] | 7 | #include "testing/gtest/include/gtest/gtest.h" |
[email protected] | 075ae034 | 2012-11-02 20:02:41 | [diff] [blame] | 8 | #include "ui/gfx/quad_f.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 9 | |
[email protected] | ba56574 | 2012-11-10 09:29:48 | [diff] [blame] | 10 | namespace cc { |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 11 | namespace { |
| 12 | |
[email protected] | 075ae034 | 2012-11-02 20:02:41 | [diff] [blame] | 13 | TEST(LayerQuadTest, QuadFConversion) |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 14 | { |
[email protected] | d455d55 | 2012-11-02 00:19:06 | [diff] [blame] | 15 | 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] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 19 | |
[email protected] | 075ae034 | 2012-11-02 20:02:41 | [diff] [blame] | 20 | gfx::QuadF quadCW(p1, p2, p3, p4); |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 21 | LayerQuad layerQuadCW(quadCW); |
[email protected] | 075ae034 | 2012-11-02 20:02:41 | [diff] [blame] | 22 | EXPECT_TRUE(layerQuadCW.ToQuadF() == quadCW); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 23 | |
[email protected] | 075ae034 | 2012-11-02 20:02:41 | [diff] [blame] | 24 | gfx::QuadF quadCCW(p1, p4, p3, p2); |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 25 | LayerQuad layerQuadCCW(quadCCW); |
[email protected] | 075ae034 | 2012-11-02 20:02:41 | [diff] [blame] | 26 | EXPECT_TRUE(layerQuadCCW.ToQuadF() == quadCCW); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 27 | } |
| 28 | |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 29 | TEST(LayerQuadTest, Inflate) |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 30 | { |
[email protected] | d455d55 | 2012-11-02 00:19:06 | [diff] [blame] | 31 | 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] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 35 | |
[email protected] | 075ae034 | 2012-11-02 20:02:41 | [diff] [blame] | 36 | gfx::QuadF quad(p1, p2, p3, p4); |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 37 | LayerQuad layerQuad(quad); |
[email protected] | 075ae034 | 2012-11-02 20:02:41 | [diff] [blame] | 38 | quad.Scale(2, 2); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 39 | layerQuad.inflate(0.5); |
[email protected] | 075ae034 | 2012-11-02 20:02:41 | [diff] [blame] | 40 | EXPECT_TRUE(layerQuad.ToQuadF() == quad); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 41 | } |
| 42 | |
[email protected] | ba56574 | 2012-11-10 09:29:48 | [diff] [blame] | 43 | } // namespace |
| 44 | } // namespace cc |