Beispiel #1
0
        public void 같은이름의_인자가_1개있는_토글의_기능동작테스트()
        {
            // Arrange (데이터 정렬)
            GameObject pObjectTester = new GameObject(nameof(같은이름의_인자가_1개있는_토글의_기능동작테스트));
            Toggle     pToggleA      = Create_ChildComponent <Toggle>(pObjectTester, HasUIToggleTester.EToggleName.Toggle_A.ToString());

            Create_ChildComponent <Toggle>(pObjectTester, HasUIToggleTester.EToggleName.Toggle_B.ToString());


            HasUIToggleTester pTester = pObjectTester.AddComponent <HasUIToggleTester>();

            pTester.Reset();
            Assert.AreEqual(pTester.iToggle_A_ClickCount, 0);
            bool bToggleA_Value = pToggleA.isOn;


            // Act (실행)
            UIActionAttributeSetter.DoSet_UIActionAttribute(pTester);
            // 스크립트로 수동으로 버튼 A 클릭
            pToggleA.OnPointerClick(_pPointerEventData);



            // Assert(맞는지 체크)
            Assert.AreNotEqual(bToggleA_Value, pToggleA.isOn);
            Assert.AreEqual(pTester.iToggle_A_ClickCount, 2);
        }
Beispiel #2
0
        public void 같은이름의_인자가없는_버튼의_기능동작테스트()
        {
            // Arrange (데이터 정렬)
            GameObject pObjectTester = new GameObject(nameof(같은이름의_인자가없는_버튼의_기능동작테스트));
            Button     pButtonA      = Create_ChildComponent <Button>(pObjectTester, HasUIButtonTester.EButtonName.Button_A.ToString());

            Create_ChildComponent <Button>(pObjectTester, HasUIButtonTester.EButtonName.Button_B.ToString());


            HasUIButtonTester pTester = pObjectTester.AddComponent <HasUIButtonTester>();

            pTester.Reset();
            Assert.AreEqual(pTester.iButton_A_ClickCount, 0);



            // Act (실행)
            UIActionAttributeSetter.DoSet_UIActionAttribute(pTester);
            // 스크립트로 수동으로 버튼 A 클릭
            pButtonA.OnPointerClick(_pPointerEventData);



            // Assert(맞는지 체크)
            Assert.AreEqual(pTester.iButton_A_ClickCount, 2);
        }
Beispiel #3
0
        public void 이벤트_중복등록_테스트()
        {
            // Arrange (데이터 정렬)
            GameObject pObjectTester = new GameObject(nameof(이벤트_중복등록_테스트));
            Button     pButtonA      = Create_ChildComponent <Button>(pObjectTester, HasUIButtonTester.EButtonName.Button_A.ToString());

            Create_ChildComponent <Button>(pObjectTester, HasUIButtonTester.EButtonName.Button_B.ToString());


            HasUIButtonTester pPrefab = pObjectTester.AddComponent <HasUIButtonTester>();

            pPrefab.Reset();
            Assert.AreEqual(pPrefab.iButton_A_ClickCount, 0);



            GameObject pObjectTester_Copy = GameObject.Instantiate(pObjectTester);
            Button     pButtonA_Copy      = pObjectTester_Copy.GetComponentsInChildren <Button>().
                                            FirstOrDefault(p => p.name.Equals(HasUIButtonTester.EButtonName.Button_A.ToString()));

            Button pButtonB_Copy = pObjectTester_Copy.GetComponentsInChildren <Button>().
                                   FirstOrDefault(p => p.name.Equals(HasUIButtonTester.EButtonName.Button_B.ToString()));

            HasUIButtonTester pTester = pObjectTester_Copy.GetComponent <HasUIButtonTester>();


            // Act (실행)
            UIActionAttributeSetter.DoSet_UIActionAttribute(pPrefab);

            // 일부러 두번실행
            UIActionAttributeSetter.DoSet_UIActionAttribute(pTester);
            UIActionAttributeSetter.DoSet_UIActionAttribute(pTester);

            // 스크립트로 수동으로 버튼 A 클릭
            pButtonA_Copy.OnPointerClick(_pPointerEventData);
            pButtonB_Copy.OnPointerClick(_pPointerEventData);


            // Assert(맞는지 체크)
            Assert.AreEqual(pPrefab.iButton_A_ClickCount, 0);
            Assert.AreEqual(pTester.iButton_A_ClickCount, 2);

            Assert.AreEqual(pPrefab.iButton_B_ClickCount, 0);
            Assert.AreEqual(pTester.iButton_B_ClickCount, 1);
        }