private void ResetFilter(Block selectedBlock) { PopulateRelevantBlocks(); if (IsRelevant(m_navigator.CurrentBlock)) { m_currentBlockIndex = 0; m_temporarilyIncludedBlock = null; } else { if (RelevantBlockCount > 0) { m_currentBlockIndex = -1; if (m_temporarilyIncludedBlock != null) { // Block that was temporarily included in previous filter might now match the new filter var i = m_relevantBlocks.IndexOf(m_temporarilyIncludedBlock); if (i >= 0) { m_currentBlockIndex = i; m_temporarilyIncludedBlock = null; SetBlock(m_relevantBlocks[m_currentBlockIndex]); return; } } LoadNextRelevantBlock(); } else if (selectedBlock != null) { m_temporarilyIncludedBlock = m_navigator.GetIndicesOfSpecificBlock(selectedBlock); m_navigator.SetIndices(m_temporarilyIncludedBlock); } else { m_temporarilyIncludedBlock = m_navigator.GetIndices(); } } }
public void SetIndices_FirstBlock() { m_navigator.SetIndices(new BookBlockIndices(0, 0)); Assert.AreEqual(m_books.First().GetScriptBlocks()[0], m_navigator.CurrentBlock); }