using Annulus; using Azimuth; using Glass.Markdown; using Glass.UnitTests.Materials; using System; using System.Collections.Generic; using System.Linq; using UnitTestSharp; namespace Glass.UnitTests { public class MarkdownViewTests : TestFixture { private const double Padding = 7; private const double BlockSpacing = 10; private const double HeadingSpacing = 20; private const double ItemSpacing = 3; private const double MarkerGap = 5; private const double RuleThickness = 2; // Every glyph is 3 wide and 4 tall, and with no margins a line of n characters measures exactly 3n by 4. public static readonly TextMaterialStyle Plain = new TextMaterialStyle { Font = TextMaterialTests.SharedMonospaceFont, VerticalMargin = 0, HorizontalMargin = 0, }; private static readonly MarkdownStyle Style = new MarkdownStyle { Body = Plain, Padding = Padding, BlockSpacing = BlockSpacing, HeadingSpacing = HeadingSpacing, ItemSpacing = ItemSpacing, MarkerGap = MarkerGap, RuleThickness = RuleThickness, }; private static MarkdownView NewView(string markdown, double width = 100, double height = 60, MarkdownStyle style = null, IReadOnlyDictionary images = null) { var view = new MarkdownView(markdown, style ?? Style, images); view.Bounds = Rect.FromPositionAndSize(Vector.Zero, new Vector(width, height)); return view; } private static List ChildrenOf(MarkdownView view) { var returnMe = new List(); foreach (Control child in view.CanvasChildren.BackToFront()) { returnMe.Add(child); } return returnMe; } private static Label LabelWith(MarkdownView view, string text) { return ChildrenOf(view).OfType