| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #if UNITY_EDITOR |
|
|
| using System; |
| using System.Collections; |
| using System.Collections.Generic; |
| using System.Xml; |
| using NUnit.Framework; |
| using UnityEngine; |
| using UnityEngine.TestTools; |
|
|
| namespace Mujoco { |
|
|
| [TestFixture] |
| public class MjSiteStateSyncTests { |
| private MjBody _body; |
| private MjSite _site; |
| private MjScene _scene; |
|
|
| [SetUp] |
| public void SetUp() { |
| _scene = MjScene.Instance; |
| _body = new GameObject("body").AddComponent<MjBody>(); |
| _site = new GameObject("site").AddComponent<MjSite>(); |
| _site.transform.parent = _body.transform; |
| } |
|
|
| [TearDown] |
| public void TearDown() { |
| GameObject.DestroyImmediate(_site.gameObject); |
| GameObject.DestroyImmediate(_body.gameObject); |
| GameObject.DestroyImmediate(_scene.gameObject); |
| GameObject.DestroyImmediate(MjScene.Instance); |
| } |
|
|
| [UnityTest] |
| public IEnumerator InitialTransform() { |
| _site.transform.position = new Vector3(1, 2, 3); |
| _scene.CreateScene(); |
| yield return new WaitForFixedUpdate(); |
| Assert.That(_site.transform.position, Is.EqualTo(new Vector3(1, 2, 3))); |
| } |
|
|
| [UnityTest] |
| public IEnumerator ChangedTransformIsOverwrittenByItsMjCounterpart() { |
| _scene.CreateScene(); |
| _site.transform.position = new Vector3(1, 2, 3); |
| yield return new WaitForFixedUpdate(); |
| Assert.That(_site.transform.position, Is.EqualTo(Vector3.zero)); |
| } |
| } |
| } |
|
|
| #endif |
|
|