OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/basictypes.h" | |
6 #include "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
7 #include "ui/gfx/geometry/rect.h" | 6 #include "ui/gfx/geometry/rect.h" |
8 #include "ui/gfx/skia_util.h" | 7 #include "ui/gfx/skia_util.h" |
9 | 8 |
10 namespace gfx { | 9 namespace gfx { |
11 | 10 |
12 TEST(RectTest, SkiaRectConversions) { | 11 TEST(RectTest, SkiaRectConversions) { |
13 Rect isrc(10, 20, 30, 40); | 12 Rect isrc(10, 20, 30, 40); |
14 RectF fsrc(10.5f, 20.5f, 30.5f, 40.5f); | 13 RectF fsrc(10.5f, 20.5f, 30.5f, 40.5f); |
15 | 14 |
16 SkIRect skirect = RectToSkIRect(isrc); | 15 SkIRect skirect = RectToSkIRect(isrc); |
17 EXPECT_EQ(isrc.ToString(), SkIRectToRect(skirect).ToString()); | 16 EXPECT_EQ(isrc.ToString(), SkIRectToRect(skirect).ToString()); |
18 | 17 |
19 SkRect skrect = RectToSkRect(isrc); | 18 SkRect skrect = RectToSkRect(isrc); |
20 EXPECT_EQ(gfx::RectF(isrc).ToString(), SkRectToRectF(skrect).ToString()); | 19 EXPECT_EQ(gfx::RectF(isrc).ToString(), SkRectToRectF(skrect).ToString()); |
21 | 20 |
22 skrect = RectFToSkRect(fsrc); | 21 skrect = RectFToSkRect(fsrc); |
23 EXPECT_EQ(fsrc.ToString(), SkRectToRectF(skrect).ToString()); | 22 EXPECT_EQ(fsrc.ToString(), SkRectToRectF(skrect).ToString()); |
24 } | 23 } |
25 | 24 |
26 } // namespace gfx | 25 } // namespace gfx |
OLD | NEW |