viewport_unittest.cc 1.2 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright 2016 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. #include "cc/layers/viewport.h"
  5. #include <stddef.h>
  6. #include "cc/test/layer_test_common.h"
  7. #include "testing/gtest/include/gtest/gtest.h"
  8. namespace cc {
  9. TEST(ViewportTest, ShouldAnimateViewport) {
  10. EXPECT_TRUE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(10, 1),
  11. gfx::Vector2dF(8, 5)));
  12. EXPECT_TRUE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(0, 10),
  13. gfx::Vector2dF(4, 8)));
  14. EXPECT_TRUE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(10, 10),
  15. gfx::Vector2dF(8, 9)));
  16. EXPECT_FALSE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(8, 10),
  17. gfx::Vector2dF(8, 10)));
  18. EXPECT_FALSE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(8, 10),
  19. gfx::Vector2dF(10, 0)));
  20. EXPECT_FALSE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(10, 10),
  21. gfx::Vector2dF(10, 18)));
  22. }
  23. } // namespace cc