public void SetUp()
 {
     // This test uses a 11x16 font.
     styleSystem         = LayoutTestStyle.CreateStyleSystem();
     textStyleDefinition = styleSystem.StylesFor <TextStyleDefinition>();
     textStyle           = LayoutTestStyle.CreateTextStyle(styleSystem);
 }
        public void SetUp()
        {
            Count       = 0;
            styleSystem = LayoutTestStyle.CreateStyleSystem();
            var textStyle = LayoutTestStyle.CreateTextStyle(styleSystem);

            var documentView = Substitute.For <IDocumentView <ITextDocument> >();

            documentView.Document.Returns((ITextDocument)null);
            documentView.Style.Returns(textStyle);
            this.doc = documentView;
        }
        BlockTextView <PlainTextDocument> CreateView(string text = null)
        {
            var doc = new PlainTextDocument();

            doc.InsertAt(0, text ?? "Hello World, Here I am. \nLong text ahead here. \nA long word, that is impossible to break apart.");

            var textStyle = LayoutTestStyle.CreateTextStyle(styleSystem);
            var factory   = new PlainTextViewFactory();
            var view      = new BlockTextView <PlainTextDocument>(doc.Root, textStyle);

            for (var i = 0; i < doc.Root.Count; i += 1)
            {
                view.Add(new ParagraphTextView <PlainTextDocument>(doc.Root[i], textStyle, factory));
            }
            return(view);
        }
Example #4
0
        public static ExposingTestChunk Create(string text, IStyleSystem styleSystem)
        {
            var length = text.Length;

            var node = Substitute.For <ITextNode>();

            node.Document.TextAt(Arg.Any <int>(), Arg.Any <int>()).Returns(text);
            var startPos = Substitute.For <ITextPosition>();

            startPos.Offset.Returns(0);

            var endPos = Substitute.For <ITextPosition>();

            endPos.Offset.Returns(length);

            var chunk = new ExposingTestChunk(new TextProcessingRules(), node, LayoutTestStyle.CreateTextStyle(styleSystem), startPos, endPos);

            chunk.Initialize();
            return(chunk);
        }
 public BranchImpl(ITextNode node, IStyleSystem styleSystem) : base(node, LayoutTestStyle.CreateTextStyle(styleSystem))
 {
 }
Example #6
0
 public TextChunkTest()
 {
     styleSystem = LayoutTestStyle.CreateStyleSystem();
     textStyle   = LayoutTestStyle.CreateTextStyle(styleSystem);
 }