コード例 #1
0
    public void TestFindElementInASceneWithNoCameras()
    {
        Assert.AreEqual(0, AltUnityDriver.GetAllCameras().Count);
        var altObject = AltUnityDriver.FindElement("Plane");

        Assert.AreEqual(0, altObject.worldX, "WorldX was: " + altObject.worldX + " when it should have been 0");
        Assert.AreEqual(0, altObject.worldY, "WorldY was: " + altObject.worldY + " when it should have been 0");
        Assert.AreEqual(0, altObject.worldZ, "WorldZ was: " + altObject.worldZ + " when it should have been 0");
        Assert.AreEqual(-1, altObject.x);
        Assert.AreEqual(-1, altObject.y);
        Assert.AreEqual(-1, altObject.z);
        Assert.AreEqual(-1, altObject.idCamera);
    }
コード例 #2
0
    public void ResizePanel()
    {
        var altElement = altUnityDriver.FindElement("Resize Zone");
        var position   = new Vector2(altElement.x, altElement.y);

        altUnityDriver.SwipeAndWait(altElement.getScreenPosition(), new Vector2(altElement.x - 200, altElement.y - 200), 2);

        Thread.Sleep(2000);
        altElement = altUnityDriver.FindElement("Resize Zone");
        var position2 = new Vector2(altElement.x, altElement.y);

        Assert.AreNotEqual(position, position2);
    }
コード例 #3
0
    public void TestFindElement()
    {
        const string name       = "Capsule";
        var          altElement = altUnityDriver.FindElement(name);

        Assert.NotNull(altElement);
        Assert.AreEqual(name, altElement.name);
    }
コード例 #4
0
    public void MultipleDragAndDrop()
    {
        var altElement1 = altUnityDriver.FindElement("Drag Image1");
        var altElement2 = altUnityDriver.FindElement("Drop Box1");

        altUnityDriver.Swipe(new Vector2(altElement1.x, altElement1.y), new Vector2(altElement2.x, altElement2.y), 1);

        altElement1 = altUnityDriver.FindElement("Drag Image2");
        altElement2 = altUnityDriver.FindElement("Drop Box2");
        altUnityDriver.Swipe(new Vector2(altElement1.x, altElement1.y), new Vector2(altElement2.x, altElement2.y), 2);

        altElement1 = altUnityDriver.FindElement("Drag Image3");
        altElement2 = altUnityDriver.FindElement("Drop Box1");
        altUnityDriver.Swipe(new Vector2(altElement1.x, altElement1.y), new Vector2(altElement2.x, altElement2.y), 2);


        altElement1 = altUnityDriver.FindElement("Drag Image1");
        altElement2 = altUnityDriver.FindElement("Drop Box1");
        altUnityDriver.Swipe(new Vector2(altElement1.x, altElement1.y), new Vector2(altElement2.x, altElement2.y), 3);

        Thread.Sleep(4000);

        var imageSource         = altUnityDriver.FindElement("Drag Image1").GetComponentProperty("UnityEngine.UI.Image", "sprite");
        var imageSourceDropZone = altUnityDriver.FindElement("Drop Image").GetComponentProperty("UnityEngine.UI.Image", "sprite");

        Assert.AreNotEqual(imageSource, imageSourceDropZone);

        imageSource         = altUnityDriver.FindElement("Drag Image2").GetComponentProperty("UnityEngine.UI.Image", "sprite");
        imageSourceDropZone = altUnityDriver.FindElement("Drop").GetComponentProperty("UnityEngine.UI.Image", "sprite");
        Assert.AreNotEqual(imageSource, imageSourceDropZone);
    }