public void ClearDeletedEntriesShouldKeepSelectedIndex()
        {
            var selectionHistory = new SelectionHistory();

            var selection1 = new GameObject();
            var selection2 = new GameObject();
            var selection3 = new GameObject();
            var selection4 = new GameObject();

            selectionHistory.UpdateSelection(selection1);
            selectionHistory.UpdateSelection(selection2);
            selectionHistory.UpdateSelection(selection3);
            selectionHistory.UpdateSelection(selection4);

            Assert.IsTrue(selectionHistory.IsSelected(3));
            Assert.AreEqual(selectionHistory.GetHistoryCount(), 4);

            GameObject.DestroyImmediate(selection2);

            selectionHistory.ClearDeleted();

            Assert.IsTrue(selectionHistory.IsSelected(2));
            Assert.AreEqual(selectionHistory.GetHistoryCount(), 3);

            selectionHistory.SetSelection(selection3);

            GameObject.DestroyImmediate(selection1);
            GameObject.DestroyImmediate(selection4);

            selectionHistory.ClearDeleted();

            Assert.IsTrue(selectionHistory.IsSelected(0));
            Assert.AreEqual(selectionHistory.GetHistoryCount(), 1);
        }
Ejemplo n.º 2
0
 public void SetSelection(Object select)
 {
     selectionHistory.SetSelection(select);
     Selection.activeObject = select;
 }
 void UpdateSelection(Object obj)
 {
     selectionHistory.SetSelection(obj);
     Selection.activeObject = obj;
     // Selection.activeObject = selectionHistory.UpdateSelection(currentIndex);
 }