Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Unified Diff: chrome/browser/android/vr_shell/ui_scene_unittest.cc

Issue 2730883003: Remove unnecessary UI element math. (Closed)
Patch Set: Add comments to non-obvious methods. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene.cc ('k') | chrome/browser/android/vr_shell/vr_math.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/ui_scene_unittest.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene_unittest.cc b/chrome/browser/android/vr_shell/ui_scene_unittest.cc
index 7f26a874a6d7f8fa3179837db31ee6b48763a8af..d04e295c9ecc7cd1f7d6b33d4b3490c866c615ae 100644
--- a/chrome/browser/android/vr_shell/ui_scene_unittest.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_unittest.cc
@@ -125,18 +125,11 @@ TEST(UiScene, ParentTransformAppliesToChild) {
const gvr::Vec3f point({1, 0, 0});
// Check resulting transform with no screen tilt.
- scene.UpdateTransforms(0, 0);
- auto new_origin = MatrixVectorMul(child->transform.to_world, origin);
- auto new_point = MatrixVectorMul(child->transform.to_world, point);
+ scene.UpdateTransforms(0);
+ auto new_origin = MatrixVectorMul(child->TransformMatrix(), origin);
+ auto new_point = MatrixVectorMul(child->TransformMatrix(), point);
EXPECT_VEC3F_NEAR(gvr::Vec3f({6, 10, 0}), new_origin);
EXPECT_VEC3F_NEAR(gvr::Vec3f({0, 10, 0}), new_point);
-
- // Check with screen tilt (use 90 degrees for simplicity).
- scene.UpdateTransforms(M_PI / 2, 0);
- new_origin = MatrixVectorMul(child->transform.to_world, origin);
- new_point = MatrixVectorMul(child->transform.to_world, point);
- EXPECT_VEC3F_NEAR(gvr::Vec3f({6, 0, 10}), new_origin);
- EXPECT_VEC3F_NEAR(gvr::Vec3f({0, 0, 10}), new_point);
}
TEST(UiScene, Opacity) {
@@ -154,7 +147,7 @@ TEST(UiScene, Opacity) {
element->opacity = 0.5;
scene.AddUiElement(element);
- scene.UpdateTransforms(0, 0);
+ scene.UpdateTransforms(0);
EXPECT_EQ(scene.GetUiElementById(0)->computed_opacity, 0.5f);
EXPECT_EQ(scene.GetUiElementById(1)->computed_opacity, 0.25f);
}
@@ -186,7 +179,7 @@ TEST_P(AnchoringTest, VerifyCorrectPosition) {
element->y_anchoring = GetParam().y_anchoring;
scene.AddUiElement(element);
- scene.UpdateTransforms(0, 0);
+ scene.UpdateTransforms(0);
const ContentRectangle* child = scene.GetUiElementById(1);
EXPECT_NEAR(child->GetCenter().x, GetParam().expected_x, TOLERANCE);
EXPECT_NEAR(child->GetCenter().y, GetParam().expected_y, TOLERANCE);
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene.cc ('k') | chrome/browser/android/vr_shell/vr_math.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698