Commit 91ca2ef2 authored by Robert Poienar's avatar Robert Poienar

Added test for call_component_method with assembly

parent 149b2186
......@@ -493,4 +493,13 @@ public void TestCallStaticMethod() throws Exception {
altUnityDriver.setTimeScale(1f);
}
@Test
public void TestCallMethodWithAssembly(){
AltUnityObject capsule = altUnityDriver.findObject(AltUnityDriver.By.NAME,"Capsule");
String initialRotation = capsule.getComponentProperty("UnityEngine.Transform", "rotation");
capsule.callComponentMethod("UnityEngine.CoreModule","UnityEngine.Transform", "Rotate", "10?10?10", "System.Single?System.Single?System.Single");
AltUnityObject capsuleAfterRotation = altUnityDriver.findObject(AltUnityDriver.By.NAME,"Capsule");
String finalRotation = capsuleAfterRotation.getComponentProperty("UnityEngine.Transform", "rotation");
assertNotEquals(initialRotation, finalRotation);
}
}
......@@ -434,6 +434,15 @@ class PythonTests(unittest.TestCase):
except WaitTimeOutException as e:
self.assertEqual(e.args[0],'Element CapsuleInfo should have text `aaaaa` but has `Capsule Info` after 1 seconds')
def test_call_method_with_assembly(self):
capsule = self.altdriver.find_object(By.NAME,"Capsule")
initialRotation = capsule.get_component_property("UnityEngine.Transform", "rotation")
capsule.call_component_method("UnityEngine.Transform", "Rotate", "10?10?10", "UnityEngine.CoreModule", "System.Single?System.Single?System.Single")
capsuleAfterRotation = self.altdriver.find_object(By.NAME,"Capsule")
finalRotation = capsuleAfterRotation.get_component_property("UnityEngine.Transform", "rotation")
self.assertNotEqual(initialRotation, finalRotation)
if __name__ == '__main__':
......
......@@ -7,6 +7,7 @@ using Assets.AltUnityTester.AltUnityDriver;
using NUnit.Framework.Constraints;
using UnityEngine;
[Timeout(5000)]
#pragma warning disable CS0618
public class TestForScene1WithOldSearch
{
private AltUnityDriver altUnityDriver;
......@@ -518,5 +519,7 @@ public class TestForScene1WithOldSearch
Assert.AreEqual(false, cube.enabled);
}
#pragma warning restore CS0618
}
\ No newline at end of file
......@@ -141,7 +141,7 @@ public class TestForScene1TestSample
{
const string name = "Cube";
var timeStart = DateTime.Now;
var altElement = altUnityDriver.WaitForElement(name,enabled:false);
var altElement = altUnityDriver.WaitForObject(AltUnityDriver.By.NAME,name,enabled:false);
var timeEnd = DateTime.Now;
var time = timeEnd - timeStart;
Assert.Less(time.TotalSeconds, 20);
......@@ -588,6 +588,15 @@ public class TestForScene1TestSample
AltUnityObject capsuleInfo = altUnityDriver.FindObject(AltUnityDriver.By.NAME,"CapsuleInfo");
Assert.AreEqual("6", capsuleInfo.GetText());
}
[Test]
public void TestCallMethodWithAssembly(){
AltUnityObject capsule = altUnityDriver.FindObject(AltUnityDriver.By.NAME,"Capsule");
var initialRotation = capsule.GetComponentProperty("UnityEngine.Transform", "rotation");
capsule.CallComponentMethod("UnityEngine.Transform", "Rotate", "10?10?10", "System.Single?System.Single?System.Single", "UnityEngine.CoreModule");
AltUnityObject capsuleAfterRotation = altUnityDriver.FindObject(AltUnityDriver.By.NAME,"Capsule");
var finalRotation = capsuleAfterRotation.GetComponentProperty("UnityEngine.Transform", "rotation");
Assert.AreNotEqual(initialRotation, finalRotation);
}
[Test]
public void TestGetAllComponents()
......
......@@ -6,6 +6,8 @@ using UnityEngine;
public class TestScene5
{
#pragma warning disable CS0618
public AltUnityDriver AltUnityDriver;
//Before any test it connects with the socket
[OneTimeSetUp]
......@@ -148,4 +150,5 @@ public class TestScene5
}
}
#pragma warning restore CS0618
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment