public void HeightGreaterWidthTest()
        {
            int containerWidth  = 50;
            int containerHeight = 100;
            int itemCount       = 4;

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

            Assert.AreEqual(objectsInfoList.Count, itemCount);

            Vector2[] expectedPositions = new Vector2[4];
            expectedPositions[0] = new Vector2(0.0f, 0.0f);
            expectedPositions[1] = new Vector2(25.0f, 0.0f);
            expectedPositions[2] = new Vector2(0.0f, -25.0f);
            expectedPositions[3] = new Vector2(25.0f, -25.0f);

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

                objectInfo.Width = 25;
            }
        }
예제 #2
0
        public void OnGridFormationClick()
        {
            if (itemToShow != null)
            {
                List <ObjectInfo> objectsInformation = FormationUtility.GetGridFormationObjectsInformation(containerWidth, containerHeight, itemCount);

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

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

            TestHelper.OverLappingTest(objectsInfoList);
        }
        public void ZeroItemsTest()
        {
            int containerWidth  = 100;
            int containerHeight = 100;
            int itemCount       = 0;

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

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

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

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

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

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

            Assert.AreEqual(objectsInfoList.Count, itemCount);

            Assert.AreEqual(0, objectsInfoList[0].Position.x);
            Assert.AreEqual(0, objectsInfoList[0].Position.y);
        }