예제 #1
0
        public IEnumerator ShouldChangeTextOnButtonClickUsingUnityEventSystemInteractionClass()
        {
            yield return(new WaitForSeconds(2));

            GameObject display     = _arium.FindGameObject("Display");
            string     initialText = "New Text";

            display.GetComponent <Text>().text = initialText;
            //Click directly using Unity Event System Interfaces (IPointerClickHandler for button to be clicked)
            UnityEventSystemInteraction <IPointerClickHandler> .PerformAction("Button");

            yield return(null);

            Assert.AreEqual("Button Clicked!", display.GetText());
        }
예제 #2
0
        public IEnumerator ShouldDragUsingUnityEventSystemInteractionClass()
        {
            const string slider = "Slider";
            const float  half   = 0.5f;

            Transform sliderTransform = _arium.GetComponent <Transform>(slider);
            var       sliderComponent = _arium.GetComponent <Slider>(slider);

            sliderComponent.value = half;
            var rect = _arium.GetComponent <RectTransform>(slider).rect;

            //Drag directly using Unity Event System Interfaces (IDragHandler for slider to be dragged)
            UnityEventSystemInteraction <IDragHandler> .PerformAction(slider, new PointerEventData(EventSystem.current){
                position = new Vector2(sliderTransform.position.x + half *rect.width, sliderTransform.position.y),
            });

            yield return(null);

            Assert.AreEqual(1, sliderComponent.value);
        }