Commit 1ec540d1 authored by Ru Cindrea's avatar Ru Cindrea

Merge branch...

Merge branch '194-add-test-for-java-method-to-callcomponentmethod-with-assembly-name-too' into 'master'

Resolve "Add test for Java method to callComponentMethod with assembly name too"

Closes #194

See merge request !111
parents af912354 ad8f1f8f
......@@ -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);
}
}
......@@ -426,6 +426,14 @@ class PythonTests(unittest.TestCase):
self.assertEqual(False,True)
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__':
suite = unittest.TestLoader().loadTestsFromTestCase(PythonTests)
......
......@@ -9,6 +9,7 @@ using UnityEngine;
using NullReferenceException = Assets.AltUnityTester.AltUnityDriver.NullReferenceException;
[Timeout(5000)]
#pragma warning disable CS0618
public class TestForScene1WithOldSearch
{
private AltUnityDriver altUnityDriver;
......@@ -520,5 +521,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