| Index: chrome/browser/android/vr_shell/ui_elements_unittest.cc
|
| diff --git a/chrome/browser/android/vr_shell/ui_elements_unittest.cc b/chrome/browser/android/vr_shell/ui_elements_unittest.cc
|
| index fd509d34c3339016c68d6bc4a92844cc34c7d6c6..56f200e3922b393f829e5eb7f0222c559057ed65 100644
|
| --- a/chrome/browser/android/vr_shell/ui_elements_unittest.cc
|
| +++ b/chrome/browser/android/vr_shell/ui_elements_unittest.cc
|
| @@ -9,18 +9,19 @@
|
| #include "base/macros.h"
|
| #include "chrome/browser/android/vr_shell/animation.h"
|
| #include "chrome/browser/android/vr_shell/easing.h"
|
| +#include "device/vr/vr_types.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| -#define EXPECT_VEC3F_EQ(a, b) \
|
| - EXPECT_FLOAT_EQ(a.x, b.x); \
|
| - EXPECT_FLOAT_EQ(a.y, b.y); \
|
| - EXPECT_FLOAT_EQ(a.z, b.z);
|
| +#define EXPECT_VEC3F_EQ(a, b) \
|
| + EXPECT_FLOAT_EQ(a.x(), b.x()); \
|
| + EXPECT_FLOAT_EQ(a.y(), b.y()); \
|
| + EXPECT_FLOAT_EQ(a.z(), b.z());
|
|
|
| -#define EXPECT_RECTF_EQ(a, b) \
|
| - EXPECT_FLOAT_EQ(a.x, b.x); \
|
| - EXPECT_FLOAT_EQ(a.y, b.y); \
|
| - EXPECT_FLOAT_EQ(a.width, b.width); \
|
| - EXPECT_FLOAT_EQ(a.height, b.height);
|
| +#define EXPECT_RECTF_EQ(a, b) \
|
| + EXPECT_FLOAT_EQ(a.x(), b.x()); \
|
| + EXPECT_FLOAT_EQ(a.y(), b.y()); \
|
| + EXPECT_FLOAT_EQ(a.width(), b.width()); \
|
| + EXPECT_FLOAT_EQ(a.height(), b.height());
|
|
|
| #define EXPECT_ROTATION(a, b) \
|
| EXPECT_FLOAT_EQ(a.x, b.x); \
|
| @@ -51,23 +52,23 @@ TEST(UiElements, AnimateCopyRect) {
|
| {20, 200, 2000, 20000}, usToTicks(50000), usToDelta(10000)));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(usToTicks(50000));
|
| - EXPECT_RECTF_EQ(rect.copy_rect, Rectf({10, 100, 1000, 10000}));
|
| + EXPECT_RECTF_EQ(rect.copy_rect, gfx::RectF(10, 100, 1000, 10000));
|
| rect.Animate(usToTicks(60000));
|
| - EXPECT_RECTF_EQ(rect.copy_rect, Rectf({20, 200, 2000, 20000}));
|
| + EXPECT_RECTF_EQ(rect.copy_rect, gfx::RectF(20, 200, 2000, 20000));
|
| }
|
|
|
| TEST(UiElements, AnimateSize) {
|
| ContentRectangle rect;
|
| - rect.size = {10, 100};
|
| + rect.size = {10, 100, 1};
|
| std::unique_ptr<Animation> animation(
|
| new Animation(0, Animation::Property::SIZE,
|
| std::unique_ptr<easing::Easing>(new easing::Linear()), {},
|
| {20, 200}, usToTicks(50000), usToDelta(10000)));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(usToTicks(50000));
|
| - EXPECT_VEC3F_EQ(rect.size, gvr::Vec3f({10, 100}));
|
| + EXPECT_VEC3F_EQ(rect.size, gfx::Vector3dF(10, 100, 1));
|
| rect.Animate(usToTicks(60000));
|
| - EXPECT_VEC3F_EQ(rect.size, gvr::Vec3f({20, 200}));
|
| + EXPECT_VEC3F_EQ(rect.size, gfx::Vector3dF(20, 200, 1));
|
| }
|
|
|
| TEST(UiElements, AnimateTranslation) {
|
| @@ -79,9 +80,9 @@ TEST(UiElements, AnimateTranslation) {
|
| {20, 200, 2000}, usToTicks(50000), usToDelta(10000)));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(usToTicks(50000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({10, 100, 1000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(10, 100, 1000));
|
| rect.Animate(usToTicks(60000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({20, 200, 2000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(20, 200, 2000));
|
| }
|
|
|
| TEST(UiElements, AnimateRotation) {
|
| @@ -93,9 +94,9 @@ TEST(UiElements, AnimateRotation) {
|
| {20, 200, 2000, 20000}, usToTicks(50000), usToDelta(10000)));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(usToTicks(50000));
|
| - EXPECT_ROTATION(rect.rotation, RotationAxisAngle({10, 100, 1000, 10000}));
|
| + EXPECT_ROTATION(rect.rotation, vr::RotationAxisAngle({10, 100, 1000, 10000}));
|
| rect.Animate(usToTicks(60000));
|
| - EXPECT_ROTATION(rect.rotation, RotationAxisAngle({20, 200, 2000, 20000}));
|
| + EXPECT_ROTATION(rect.rotation, vr::RotationAxisAngle({20, 200, 2000, 20000}));
|
| }
|
|
|
| TEST(UiElements, AnimationHasNoEffectBeforeScheduledStart) {
|
| @@ -106,7 +107,7 @@ TEST(UiElements, AnimationHasNoEffectBeforeScheduledStart) {
|
| {20, 200, 2000}, usToTicks(50000), usToDelta(10000)));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(usToTicks(49999));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({0, 0, 0}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(0, 0, 0));
|
| }
|
|
|
| TEST(UiElements, AnimationPurgedWhenDone) {
|
| @@ -128,11 +129,11 @@ TEST(UiElements, AnimationLinearEasing) {
|
| {20, 200, 2000}, usToTicks(50000), usToDelta(10000)));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(usToTicks(50000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({10, 100, 1000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(10, 100, 1000));
|
| rect.Animate(usToTicks(55000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({15, 150, 1500}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(15, 150, 1500));
|
| rect.Animate(usToTicks(60000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({20, 200, 2000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(20, 200, 2000));
|
| }
|
|
|
| TEST(UiElements, AnimationStartFromSpecifiedLocation) {
|
| @@ -143,9 +144,9 @@ TEST(UiElements, AnimationStartFromSpecifiedLocation) {
|
| {20, 200, 2000}, usToTicks(50000), usToDelta(10000)));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(usToTicks(50000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({10, 100, 1000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(10, 100, 1000));
|
| rect.Animate(usToTicks(60000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({20, 200, 2000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(20, 200, 2000));
|
| }
|
|
|
| // Ensure that when a new animation overlaps another of the same type, the
|
| @@ -166,11 +167,11 @@ TEST(UiElements, AnimationOverlap) {
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.animations.emplace_back(std::move(animation2));
|
| rect.Animate(usToTicks(55000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({10, 100, 1000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(10, 100, 1000));
|
| rect.Animate(usToTicks(60000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({30, 300, 3000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(30, 300, 3000));
|
| rect.Animate(usToTicks(65000));
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({50, 500, 5000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(50, 500, 5000));
|
| }
|
|
|
| } // namespace vr_shell
|
|
|