| 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 83183dc589fbf1b4de57d629c0ee6277c3a117a6..5c653dbf2785c2ed86bb9d4b4e0069cd1c3e0fb5 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); \
|
| @@ -39,23 +40,23 @@ TEST(UiElements, AnimateCopyRect) {
|
| {20, 200, 2000, 20000}, 50000, 10000));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(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(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}, 50000, 10000));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(50000);
|
| - EXPECT_VEC3F_EQ(rect.size, gvr::Vec3f({10, 100}));
|
| + EXPECT_VEC3F_EQ(rect.size, gfx::Vector3dF(10, 100, 1));
|
| rect.Animate(60000);
|
| - EXPECT_VEC3F_EQ(rect.size, gvr::Vec3f({20, 200}));
|
| + EXPECT_VEC3F_EQ(rect.size, gfx::Vector3dF(20, 200, 1));
|
| }
|
|
|
| TEST(UiElements, AnimateTranslation) {
|
| @@ -67,9 +68,9 @@ TEST(UiElements, AnimateTranslation) {
|
| {20, 200, 2000}, 50000, 10000));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(50000);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({10, 100, 1000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(10, 100, 1000));
|
| rect.Animate(60000);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({20, 200, 2000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(20, 200, 2000));
|
| }
|
|
|
| TEST(UiElements, AnimateRotation) {
|
| @@ -81,9 +82,9 @@ TEST(UiElements, AnimateRotation) {
|
| {20, 200, 2000, 20000}, 50000, 10000));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(50000);
|
| - EXPECT_ROTATION(rect.rotation, RotationAxisAngle({10, 100, 1000, 10000}));
|
| + EXPECT_ROTATION(rect.rotation, vr::RotationAxisAngle({10, 100, 1000, 10000}));
|
| rect.Animate(60000);
|
| - EXPECT_ROTATION(rect.rotation, RotationAxisAngle({20, 200, 2000, 20000}));
|
| + EXPECT_ROTATION(rect.rotation, vr::RotationAxisAngle({20, 200, 2000, 20000}));
|
| }
|
|
|
| TEST(UiElements, AnimationHasNoEffectBeforeScheduledStart) {
|
| @@ -94,7 +95,7 @@ TEST(UiElements, AnimationHasNoEffectBeforeScheduledStart) {
|
| {10, 100, 1000}, {20, 200, 2000}, 50000, 10000));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(49999);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({0, 0, 0}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(0, 0, 0));
|
| }
|
|
|
| TEST(UiElements, AnimationPurgedWhenDone) {
|
| @@ -116,11 +117,11 @@ TEST(UiElements, AnimationLinearEasing) {
|
| {10, 100, 1000}, {20, 200, 2000}, 50000, 10000));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(50000);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({10, 100, 1000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(10, 100, 1000));
|
| rect.Animate(55000);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({15, 150, 1500}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(15, 150, 1500));
|
| rect.Animate(60000);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({20, 200, 2000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(20, 200, 2000));
|
| }
|
|
|
| TEST(UiElements, AnimationStartFromSpecifiedLocation) {
|
| @@ -131,9 +132,9 @@ TEST(UiElements, AnimationStartFromSpecifiedLocation) {
|
| {10, 100, 1000}, {20, 200, 2000}, 50000, 10000));
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.Animate(50000);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({10, 100, 1000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(10, 100, 1000));
|
| rect.Animate(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
|
| @@ -154,11 +155,11 @@ TEST(UiElements, AnimationOverlap) {
|
| rect.animations.emplace_back(std::move(animation));
|
| rect.animations.emplace_back(std::move(animation2));
|
| rect.Animate(55000);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({10, 100, 1000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(10, 100, 1000));
|
| rect.Animate(60000);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({30, 300, 3000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(30, 300, 3000));
|
| rect.Animate(65000);
|
| - EXPECT_VEC3F_EQ(rect.translation, gvr::Vec3f({50, 500, 5000}));
|
| + EXPECT_VEC3F_EQ(rect.translation, gfx::Vector3dF(50, 500, 5000));
|
| }
|
|
|
| } // namespace vr_shell
|
|
|