public void ShiftCallbackTest() { foreach (var testCase in m_shiftCallbackTestCases) { var unitGaridManager = new UnitGridManager (testCase.gridWidth, testCase.gridHeight, testCase.horizontalCount, testCase.verticalCount); unitGaridManager.UpdateElementCount(testCase.elementCount); foreach (var shiftCallback in testCase.shiftCallbacks) { var movedIndexes = new List <int>(); var dataUpdatedIndexes = new List <int>(); unitGaridManager.Shift(shiftCallback.scrollValue, (index, delta) => { movedIndexes.Add(index); }, (index, delta) => { dataUpdatedIndexes.Add(index); }); Assert.True(IsSamePrimitiveList(movedIndexes, shiftCallback.expectedMovedIndexes)); Assert.True(IsSamePrimitiveList(dataUpdatedIndexes, shiftCallback.expectedUpdatedIndexes)); } } }
public void Initialize() { m_initialized = true; if (m_unitGridManager == null) { m_unitGridManager = new UnitGridManager( m_gridWidth, m_gridHeight, m_horizontalCount, m_verticalCount); } SetUpListItems(); }
public void ShiftTest() { foreach (var testCase in m_shiftTestCases) { var unitGaridManager = new UnitGridManager (testCase.gridWidth, testCase.gridHeight, testCase.horizontalCount, testCase.verticalCount); unitGaridManager.UpdateElementCount(testCase.elementCount); foreach (var verticalOffset in testCase.verticalOffsets) { unitGaridManager.Shift(verticalOffset.scrollValue, null, null); Assert.True(unitGaridManager.GetVerticalOffset() == verticalOffset.expected); } } }
public void InitialConditionTest() { foreach (var testCase in m_initialConditionTestCases) { var unitGaridManager = new UnitGridManager (testCase.gridWidth, testCase.gridHeight, testCase.horizontalCount, testCase.verticalCount); unitGaridManager.UpdateElementCount(testCase.elementCount); Assert.True(unitGaridManager.GetVerticalOffset() == testCase.expectedVerticalOffset); Assert.True(unitGaridManager.GetScrollRectHeight() == testCase.expectedScrollRectHeight); foreach (var initialPosition in testCase.initialPositions) { Assert.True(unitGaridManager.GetInitialPosition(initialPosition.index) == initialPosition.expected); } } }