OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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 |
| 5 #include "cc/tile_priority.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace cc { |
| 10 |
| 11 class TilePriorityTest : public testing::Test { |
| 12 public: |
| 13 TilePriorityTest() {} |
| 14 |
| 15 void VerifyTimeForBoundsToIntersect(gfx::Rect previous, |
| 16 gfx::Rect current, |
| 17 gfx::Rect target, |
| 18 double time) { |
| 19 EXPECT_EQ(time, TilePriority::TimeForBoundsToIntersect( |
| 20 previous, current, 1, target)); |
| 21 } |
| 22 }; |
| 23 |
| 24 TEST_F(TilePriorityTest, TimeForBoundsToIntersectWithScroll) { |
| 25 gfx::Rect target(0, 0, 800, 600); |
| 26 gfx::Rect current(100, 100, 100, 100); |
| 27 VerifyTimeForBoundsToIntersect( |
| 28 gfx::Rect(-200, 0, 100, 100), current, target, 0); |
| 29 VerifyTimeForBoundsToIntersect( |
| 30 gfx::Rect(-100, 0, 100, 100), current, target, 0); |
| 31 VerifyTimeForBoundsToIntersect( |
| 32 gfx::Rect(400, 400, 100, 100), current, target, 0); |
| 33 |
| 34 current = gfx::Rect(-300, -300, 100, 100); |
| 35 VerifyTimeForBoundsToIntersect( |
| 36 gfx::Rect(0, 0, 100, 100), current, target, 1000); |
| 37 VerifyTimeForBoundsToIntersect( |
| 38 gfx::Rect(-200, -200, 100, 100), current, target, 1000); |
| 39 VerifyTimeForBoundsToIntersect( |
| 40 gfx::Rect(-400, -400, 100, 100), current, target, 2); |
| 41 } |
| 42 |
| 43 TEST_F(TilePriorityTest, TimeForBoundsToIntersectWithScale) { |
| 44 gfx::Rect target(0, 0, 800, 600); |
| 45 gfx::Rect current(100, 100, 100, 100); |
| 46 VerifyTimeForBoundsToIntersect( |
| 47 gfx::Rect(-200, 0, 200, 200), current, target, 0); |
| 48 VerifyTimeForBoundsToIntersect( |
| 49 gfx::Rect(-100, 0, 50, 50), current, target, 0); |
| 50 VerifyTimeForBoundsToIntersect( |
| 51 gfx::Rect(400, 400, 400, 400), current, target, 0); |
| 52 |
| 53 current = gfx::Rect(-300, -300, 100, 100); |
| 54 VerifyTimeForBoundsToIntersect( |
| 55 gfx::Rect(-400, -400, 300, 300), current, target, 1000); |
| 56 VerifyTimeForBoundsToIntersect( |
| 57 gfx::Rect(-275, -275, 50, 50), current, target, 8); |
| 58 VerifyTimeForBoundsToIntersect( |
| 59 gfx::Rect(-450, -450, 50, 50), current, target, 1); |
| 60 } |
| 61 |
| 62 } // namespace cc |
OLD | NEW |