internal static void CheckHeights(TextDocument document, HeightTree heightTree) { double[] heights = document.Lines.Select(l => heightTree.GetIsCollapsed(l) ? 0 : heightTree.GetHeight(l)).ToArray(); double[] visualPositions = new double[document.LineCount + 1]; for (int i = 0; i < heights.Length; i++) { visualPositions[i + 1] = visualPositions[i] + heights[i]; } foreach (DocumentLine ls in document.Lines) { Assert.AreEqual(visualPositions[ls.LineNumber - 1], heightTree.GetVisualPosition(ls)); } Assert.AreEqual(visualPositions[document.LineCount], heightTree.TotalHeight); }
CollapsedLineSection SimpleCheck(int from, int to) { CollapsedLineSection sec1 = heightTree.CollapseText(document.GetLineByNumber(from), document.GetLineByNumber(to)); for (int i = 1; i < from; i++) { Assert.IsFalse(heightTree.GetIsCollapsed(i)); } for (int i = from; i <= to; i++) { Assert.IsTrue(heightTree.GetIsCollapsed(i)); } for (int i = to + 1; i <= 10; i++) { Assert.IsFalse(heightTree.GetIsCollapsed(i)); } CheckHeights(); return(sec1); }