| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/vr_shell/ui_scene.h" | 5 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| 6 | 6 |
| 7 #define _USE_MATH_DEFINES // For M_PI in MSVC. | 7 #define _USE_MATH_DEFINES // For M_PI in MSVC. |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 TEST(UiScene, AddUiElementFromDictionary) { | 185 TEST(UiScene, AddUiElementFromDictionary) { |
| 186 UiScene scene; | 186 UiScene scene; |
| 187 addElement(&scene, 11); | 187 addElement(&scene, 11); |
| 188 | 188 |
| 189 base::DictionaryValue dict; | 189 base::DictionaryValue dict; |
| 190 | 190 |
| 191 dict.SetInteger("id", 10); | 191 dict.SetInteger("id", 10); |
| 192 dict.SetInteger("parentId", 11); | 192 dict.SetInteger("parentId", 11); |
| 193 dict.SetBoolean("visible", false); | 193 dict.SetBoolean("visible", false); |
| 194 dict.SetBoolean("passive", true); |
| 195 dict.SetBoolean("lockToFov", true); |
| 194 | 196 |
| 195 std::unique_ptr<base::DictionaryValue> copy_rect(new base::DictionaryValue); | 197 std::unique_ptr<base::DictionaryValue> copy_rect(new base::DictionaryValue); |
| 196 copy_rect->SetInteger("x", 100); | 198 copy_rect->SetInteger("x", 100); |
| 197 copy_rect->SetInteger("y", 101); | 199 copy_rect->SetInteger("y", 101); |
| 198 copy_rect->SetInteger("width", 102); | 200 copy_rect->SetInteger("width", 102); |
| 199 copy_rect->SetInteger("height", 103); | 201 copy_rect->SetInteger("height", 103); |
| 200 dict.Set("copyRect", std::move(copy_rect)); | 202 dict.Set("copyRect", std::move(copy_rect)); |
| 201 | 203 |
| 202 std::unique_ptr<base::DictionaryValue> size(new base::DictionaryValue); | 204 std::unique_ptr<base::DictionaryValue> size(new base::DictionaryValue); |
| 203 size->SetDouble("x", 200); | 205 size->SetDouble("x", 200); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 226 dict.SetInteger("xAnchoring", XAnchoring::XLEFT); | 228 dict.SetInteger("xAnchoring", XAnchoring::XLEFT); |
| 227 dict.SetInteger("yAnchoring", YAnchoring::YTOP); | 229 dict.SetInteger("yAnchoring", YAnchoring::YTOP); |
| 228 | 230 |
| 229 scene.AddUiElementFromDict(dict); | 231 scene.AddUiElementFromDict(dict); |
| 230 const auto *element = scene.GetUiElementById(10); | 232 const auto *element = scene.GetUiElementById(10); |
| 231 EXPECT_NE(element, nullptr); | 233 EXPECT_NE(element, nullptr); |
| 232 | 234 |
| 233 EXPECT_EQ(element->id, 10); | 235 EXPECT_EQ(element->id, 10); |
| 234 EXPECT_EQ(element->parent_id, 11); | 236 EXPECT_EQ(element->parent_id, 11); |
| 235 EXPECT_EQ(element->visible, false); | 237 EXPECT_EQ(element->visible, false); |
| 238 EXPECT_EQ(element->passive, true); |
| 239 EXPECT_EQ(element->lock_to_fov, true); |
| 236 | 240 |
| 237 EXPECT_EQ(element->copy_rect.x, 100); | 241 EXPECT_EQ(element->copy_rect.x, 100); |
| 238 EXPECT_EQ(element->copy_rect.y, 101); | 242 EXPECT_EQ(element->copy_rect.y, 101); |
| 239 EXPECT_EQ(element->copy_rect.width, 102); | 243 EXPECT_EQ(element->copy_rect.width, 102); |
| 240 EXPECT_EQ(element->copy_rect.height, 103); | 244 EXPECT_EQ(element->copy_rect.height, 103); |
| 241 | 245 |
| 242 EXPECT_FLOAT_EQ(element->size.x, 200); | 246 EXPECT_FLOAT_EQ(element->size.x, 200); |
| 243 EXPECT_FLOAT_EQ(element->size.y, 201); | 247 EXPECT_FLOAT_EQ(element->size.y, 201); |
| 244 EXPECT_FLOAT_EQ(element->size.z, 1); | 248 EXPECT_FLOAT_EQ(element->size.z, 1); |
| 245 | 249 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 EXPECT_FLOAT_EQ(animation->from[0], 300); | 313 EXPECT_FLOAT_EQ(animation->from[0], 300); |
| 310 EXPECT_FLOAT_EQ(animation->from[1], 301); | 314 EXPECT_FLOAT_EQ(animation->from[1], 301); |
| 311 EXPECT_FLOAT_EQ(animation->from[2], 302); | 315 EXPECT_FLOAT_EQ(animation->from[2], 302); |
| 312 EXPECT_FLOAT_EQ(animation->from[3], 303); | 316 EXPECT_FLOAT_EQ(animation->from[3], 303); |
| 313 | 317 |
| 314 EXPECT_EQ(animation->start, 22345000); | 318 EXPECT_EQ(animation->start, 22345000); |
| 315 EXPECT_EQ(animation->duration, 54321000); | 319 EXPECT_EQ(animation->duration, 54321000); |
| 316 } | 320 } |
| 317 | 321 |
| 318 } // namespace vr_shell | 322 } // namespace vr_shell |
| OLD | NEW |