summaryrefslogtreecommitdiffstats
path: root/chromium/cc/layers/viewport_unittest.cc
blob: d2646a26886f1ced204396df1acb619505aca4d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/layers/viewport.h"

#include <stddef.h>

#include "cc/test/layer_test_common.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace cc {

TEST(ViewportTest, ShouldAnimateViewport) {
  EXPECT_TRUE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(10, 1),
                                              gfx::Vector2dF(8, 5)));
  EXPECT_TRUE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(0, 10),
                                              gfx::Vector2dF(4, 8)));
  EXPECT_TRUE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(10, 10),
                                              gfx::Vector2dF(8, 9)));

  EXPECT_FALSE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(8, 10),
                                               gfx::Vector2dF(8, 10)));
  EXPECT_FALSE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(8, 10),
                                               gfx::Vector2dF(10, 0)));
  EXPECT_FALSE(Viewport::ShouldAnimateViewport(gfx::Vector2dF(10, 10),
                                               gfx::Vector2dF(10, 18)));
}

}  // namespace cc