Ejemplo n.º 1
0
        public void OnCircleFormationClick()
        {
            if (itemToShow != null)
            {
                List <ObjectInfo> objectsInformation = FormationUtility.GetCircleFormationObjectsInformation(containerWidth, containerHeight, itemCount);

                RenderObjects(objectsInformation);
            }
        }
        public void FourItemsOverlapTest()
        {
            int containerWidth  = 100;
            int containerHeight = 100;
            int itemCount       = 4;

            List <ObjectInfo> objectsInfoList = FormationUtility.GetCircleFormationObjectsInformation(containerWidth, containerHeight, itemCount);

            TestHelper.OverLappingTest(objectsInfoList);
        }
        public void WidthHeightUnequalTest()
        {
            int containerWidth  = 50;
            int containerHeight = 100;
            int itemCount       = 5;

            List <ObjectInfo> objectsInfoList = FormationUtility.GetCircleFormationObjectsInformation(containerWidth, containerHeight, itemCount);

            Assert.AreEqual(objectsInfoList.Count, itemCount);
        }
        public void HundredItemContainingTest()
        {
            int containerWidth  = 100;
            int containerHeight = 100;
            int itemCount       = 100;

            Rect containerBounds = new Rect(0, 0, containerWidth, containerHeight);

            List <ObjectInfo> objectsInfoList = FormationUtility.GetCircleFormationObjectsInformation(containerWidth, containerHeight, itemCount);

            TestHelper.CheckIfAllObjectsInsideContainer(containerBounds, objectsInfoList);
        }
        public void OneItemTest()
        {
            int containerWidth  = 100;
            int containerHeight = 100;
            int itemCount       = 1;

            List <ObjectInfo> objectsInfoList = FormationUtility.GetCircleFormationObjectsInformation(containerWidth, containerHeight, itemCount);

            Assert.AreEqual(objectsInfoList.Count, itemCount);

            Assert.AreEqual(25.0f, objectsInfoList[0].Position.x);
            Assert.AreEqual(-25.0f, objectsInfoList[0].Position.y);

            Assert.AreEqual(50.0f, objectsInfoList[0].Width);
        }
        public void TwoItemsTest()
        {
            int containerWidth  = 100;
            int containerHeight = 100;
            int itemCount       = 2;

            List <ObjectInfo> objectsInfoList = FormationUtility.GetCircleFormationObjectsInformation(containerWidth, containerHeight, itemCount);

            Assert.AreEqual(objectsInfoList.Count, itemCount);

            Vector2[] expectedPositions = new Vector2[2];
            expectedPositions[0] = new Vector2(25, 0);
            expectedPositions[1] = new Vector2(25, -50);

            for (int i = 0; i < objectsInfoList.Count; i++)
            {
                Assert.AreEqual(expectedPositions[i].x, objectsInfoList[i].Position.x, 0.0001);
                Assert.AreEqual(expectedPositions[i].y, objectsInfoList[i].Position.y, 0.0001);
            }
        }