Tanoda
TestInstantiation.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9#if LEAP_TESTS
10using UnityEngine;
11using UnityEngine.TestTools;
12using NUnit.Framework;
13using System.Collections;
14
16
17 public class TestInstantiation : GraphicRendererTestBase {
18
23 [UnityTest]
24 public IEnumerator InstantiateToRootOfScene() {
25 InitTest("OneDynamicGroup");
26 yield return null;
27
28 //Instantiates to root of scene, not of the renderer
29 var otherGraphic = Object.Instantiate(oneGraphic);
30
31 Assert.That(otherGraphic.isAttachedToGroup, Is.False);
32 Assert.That(oneGraphic.attachedGroup.graphics, Does.Not.Contains(otherGraphic));
33 }
34
39 [UnityTest]
40 public IEnumerator InstantiateChildOfRenderer() {
41 InitTest("OneDynamicGroup");
42 yield return null;
43
44 //Instantiates to root of renderer
45 var otherGraphic = Object.Instantiate(oneGraphic, renderer.transform);
46
47 yield return null;
48
49 Assert.That(otherGraphic.isAttachedToGroup, Is.True);
50 Assert.That(oneGraphic.attachedGroup.graphics, Does.Contain(otherGraphic));
51 }
52 }
53}
54#endif
UnityEngine.Object Object