public void InitializeSpringMassSystem_test_stiffness() { CreateLines cl = new CreateLines(); SpringMassSystem sms = new SpringMassSystem(0.01f, 1.0f, 1.0f, 0.15f, 0.0f, 40.0f); //range of 0-40s with data points every 0.5s Assert.IsTrue(Mathf.Approximately((float)sms.Stiffness, 1.0f)); }
public void PausingWorks() { EditorSceneManager.OpenScene((Application.dataPath + "/SpringMass/MainScene.Unity")); GameObject LM = GameObject.Find("LineMaster"); CreateLines ls = LM.GetComponent <CreateLines>(); ls.started = 1; ls.pause = 0; ls.InitializeSimulation(); ls.Update(); ls.Update(); ls.Update(); float testTime = ls.time; ls.pause = 1; ls.Update(); ls.Update(); ls.Update(); Assert.IsTrue(Mathf.Approximately(ls.time, testTime)); // Assert.IsFalse( // Mathf.Approximately(0.0f, ls.velX )); //Any change for velX }
public void UpdateWithStarted_x() { EditorSceneManager.OpenScene((Application.dataPath + "/SpringMass/MainScene.Unity")); GameObject LM = GameObject.Find("LineMaster"); CreateLines ls = LM.GetComponent <CreateLines>(); ls.InitializeSimulation(); ls.started = 1; ls.Update(); Assert.IsFalse(Mathf.Approximately(-2f, ls.mx)); //Any change for mx }
public void UpdateWithoutStarted_x() { GameObject lines = new GameObject(); lines.AddComponent <CreateLines>(); CreateLines ls = lines.GetComponent <CreateLines>(); //ls.InitializeSimulation(); ls.Update(); Debug.Log(ls.mx); Assert.IsTrue( Mathf.Approximately(-2.0f, ls.mx)); //No change for mx }
public void InitializeSimulation() { EditorSceneManager.OpenScene((Application.dataPath + "/SpringMass/MainScene.Unity")); GameObject LM = GameObject.Find("LineMaster"); CreateLines ls = LM.GetComponent <CreateLines>(); try { ls.InitializeSimulation(); } catch (Exception e) { Debug.LogAssertion(e); Assert.IsTrue(false); } }
public void ToggleVR() { GameObject lines = new GameObject(); lines.AddComponent <CreateLines>(); CreateLines ls = lines.GetComponent <CreateLines>(); try{ ls.TestVR(); //Toggle on ls.TestVR(); //Toggle off ls.MenuButton_OnPress(); } catch (Exception e) { Debug.LogAssertion(e); Assert.IsTrue(false); } }
public void callOnGui() { EditorSceneManager.OpenScene((Application.dataPath + "/SpringMass/MainScene.Unity")); GameObject LM = GameObject.Find("LineMaster"); CreateLines ls = LM.GetComponent <CreateLines>(); //GameObject lines = new GameObject(); //lines.AddComponent<CreateLines>(); try{ //lines.GetComponent<CreateLines>().OnGUI(); ls.GetComponent <CreateLines>().OnGUI(); } catch (Exception e) { Debug.LogAssertion(e); Assert.IsTrue(true); } }
public void CallLineDotCSFunctions() { EditorSceneManager.OpenScene((Application.dataPath + "/SpringMass/MainScene.Unity")); GameObject LM = GameObject.Find("LineMaster"); CreateLines ls = LM.GetComponent <CreateLines>(); ls.InitializeSimulation(); try{ ls.instance[0].GetComponent <Line>().Start(); ls.instance[0].GetComponent <Line>().Update(); ls.instance[9].GetComponent <Line>().Start(); ls.instance[9].GetComponent <Line>().Update(); } catch (Exception e) { Debug.LogAssertion(e); Assert.IsTrue(false); } }