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 <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 AnchoringTest, | 218 AnchoringTest, |
219 ::testing::ValuesIn(anchoring_test_cases)); | 219 ::testing::ValuesIn(anchoring_test_cases)); |
220 | 220 |
221 TEST(UiScene, AddUiElementFromDictionary) { | 221 TEST(UiScene, AddUiElementFromDictionary) { |
222 UiScene scene; | 222 UiScene scene; |
223 addElement(&scene, 11); | 223 addElement(&scene, 11); |
224 | 224 |
225 base::DictionaryValue dict; | 225 base::DictionaryValue dict; |
226 | 226 |
227 dict.SetInteger("id", 10); | 227 dict.SetInteger("id", 10); |
| 228 dict.SetString("name", "abc"); |
228 dict.SetInteger("parentId", 11); | 229 dict.SetInteger("parentId", 11); |
229 dict.SetBoolean("visible", false); | 230 dict.SetBoolean("visible", false); |
230 dict.SetBoolean("hitTestable", false); | 231 dict.SetBoolean("hitTestable", false); |
231 dict.SetInteger("fillType", Fill::SPRITE); | 232 dict.SetInteger("fillType", Fill::SPRITE); |
232 dict.SetInteger("xAnchoring", XAnchoring::XLEFT); | 233 dict.SetInteger("xAnchoring", XAnchoring::XLEFT); |
233 dict.SetInteger("yAnchoring", YAnchoring::YTOP); | 234 dict.SetInteger("yAnchoring", YAnchoring::YTOP); |
234 dict.SetDouble("opacity", 0.357); | 235 dict.SetDouble("opacity", 0.357); |
235 | 236 |
236 dict.SetInteger("copyRectX", 100); | 237 dict.SetInteger("copyRectX", 100); |
237 dict.SetInteger("copyRectY", 101); | 238 dict.SetInteger("copyRectY", 101); |
(...skipping 14 matching lines...) Expand all Loading... |
252 | 253 |
253 dict.SetDouble("translationX", 500); | 254 dict.SetDouble("translationX", 500); |
254 dict.SetDouble("translationY", 501); | 255 dict.SetDouble("translationY", 501); |
255 dict.SetDouble("translationZ", 502); | 256 dict.SetDouble("translationZ", 502); |
256 | 257 |
257 scene.AddUiElementFromDict(dict); | 258 scene.AddUiElementFromDict(dict); |
258 const auto* element = scene.GetUiElementById(10); | 259 const auto* element = scene.GetUiElementById(10); |
259 EXPECT_NE(element, nullptr); | 260 EXPECT_NE(element, nullptr); |
260 | 261 |
261 EXPECT_EQ(element->id, 10); | 262 EXPECT_EQ(element->id, 10); |
| 263 EXPECT_EQ(element->name, "abc"); |
262 EXPECT_EQ(element->parent_id, 11); | 264 EXPECT_EQ(element->parent_id, 11); |
263 EXPECT_EQ(element->visible, false); | 265 EXPECT_EQ(element->visible, false); |
264 EXPECT_EQ(element->hit_testable, false); | 266 EXPECT_EQ(element->hit_testable, false); |
265 EXPECT_EQ(element->fill, Fill::SPRITE); | 267 EXPECT_EQ(element->fill, Fill::SPRITE); |
266 EXPECT_EQ(element->x_anchoring, XAnchoring::XLEFT); | 268 EXPECT_EQ(element->x_anchoring, XAnchoring::XLEFT); |
267 EXPECT_EQ(element->y_anchoring, YAnchoring::YTOP); | 269 EXPECT_EQ(element->y_anchoring, YAnchoring::YTOP); |
268 EXPECT_FLOAT_EQ(element->opacity, 0.357); | 270 EXPECT_FLOAT_EQ(element->opacity, 0.357); |
269 | 271 |
270 EXPECT_EQ(element->copy_rect.x, 100); | 272 EXPECT_EQ(element->copy_rect.x, 100); |
271 EXPECT_EQ(element->copy_rect.y, 101); | 273 EXPECT_EQ(element->copy_rect.y, 101); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 EXPECT_FLOAT_EQ(animation->from[0], 300); | 435 EXPECT_FLOAT_EQ(animation->from[0], 300); |
434 EXPECT_FLOAT_EQ(animation->from[1], 301); | 436 EXPECT_FLOAT_EQ(animation->from[1], 301); |
435 EXPECT_FLOAT_EQ(animation->from[2], 302); | 437 EXPECT_FLOAT_EQ(animation->from[2], 302); |
436 EXPECT_FLOAT_EQ(animation->from[3], 303); | 438 EXPECT_FLOAT_EQ(animation->from[3], 303); |
437 | 439 |
438 EXPECT_EQ(animation->start, 22345000); | 440 EXPECT_EQ(animation->start, 22345000); |
439 EXPECT_EQ(animation->duration, 54321000); | 441 EXPECT_EQ(animation->duration, 54321000); |
440 } | 442 } |
441 | 443 |
442 } // namespace vr_shell | 444 } // namespace vr_shell |
OLD | NEW |