Пример #1
0
        public void BuildTokenListTest()
        {
            var rtfParagraph = new RtfParagraph(true, true, ReadingDirection.LeftToRight);

            rtfParagraph.setText("Test Token Method");
            rtfParagraph.addCharFormat(-1, -1);
            Assert.DoesNotThrow(() => rtfParagraph.render());
        }
Пример #2
0
        public void TestDefaultCharFormatProperty()
        {
            var text         = "Test Paragraph";
            var rtfParagraph = new RtfParagraph(true, true);

            rtfParagraph.setText(text);
            Assert.DoesNotThrow(() => { var defaultCharformat = rtfParagraph.DefaultCharFormat; });
        }
Пример #3
0
        public void AddFootNoteForParagraph()
        {
            var text         = "Test FootNote";
            var rtfParagraph = new RtfParagraph(true, true);

            rtfParagraph.setText(text);
            Assert.DoesNotThrow(() => rtfParagraph.addFootnote(1));
        }
Пример #4
0
        public void TestFirstLineIndentPropertySet()
        {
            var text         = "Test Paragraph";
            var rtfParagraph = new RtfParagraph(true, true);

            rtfParagraph.FirstLineIndent = 2;
            rtfParagraph.setText(text);
            Assert.AreEqual(2, rtfParagraph.FirstLineIndent);
        }
Пример #5
0
        public void TestLineSpacingPropertySet()
        {
            var text         = "Test Paragraph";
            var rtfParagraph = new RtfParagraph(true, true);

            rtfParagraph.LineSpacing = 2;
            rtfParagraph.setText(text);
            Assert.AreEqual(2, rtfParagraph.LineSpacing);
        }
Пример #6
0
        public void GenerateExceptionWhenEnd_GreaterThanOrEqualTo_TextLength()
        {
            var text         = "Test Token Method";
            int end          = text.Length;
            var rtfParagraph = new RtfParagraph(true, true, ReadingDirection.LeftToRight);

            rtfParagraph.setText(text);
            Assert.Throws <Exception>(() => rtfParagraph.addCharFormat(0, text.Length));
        }
Пример #7
0
        public void BuildTokenListTestForTotalParagraph()
        {
            var text         = "Test Token Method";
            var rtfParagraph = new RtfParagraph(true, true, ReadingDirection.LeftToRight);

            rtfParagraph.setText(text);
            rtfParagraph.addCharFormat(0, text.Length - 1);
            Assert.DoesNotThrow(() => rtfParagraph.render());
        }
Пример #8
0
        public void AddCharFormatForParagraphWithoutBeginandEnd()
        {
            var text         = "Test Paragraph";
            var rtfParagraph = new RtfParagraph(true, true);

            rtfParagraph.setText(text);
            var charFormat = rtfParagraph.addCharFormat();

            Assert.AreEqual(text.Length, rtfParagraph.Text.Length);
            Assert.IsNotNull(charFormat);
        }
Пример #9
0
        public void AddCharFormatForParagraph()
        {
            var text         = "Test Paragraph";
            var rtfParagraph = new RtfParagraph(true, true);

            rtfParagraph.LineSpacing     = 2;
            rtfParagraph.FirstLineIndent = 2;
            rtfParagraph.StartNewPage    = false;
            rtfParagraph.setText(text);
            var charFormat = rtfParagraph.addCharFormat(1, 6);

            Assert.AreEqual(text.Length, rtfParagraph.Text.Length);
            Assert.IsNotNull(charFormat);
        }
Пример #10
0
        public void LTR_ParagraphRender()
        {
            var textPara = "Test Paragraph";
            var sb       = new StringBuilder();

            sb.AppendLine(string.Format(@"{{\pard\fi0\{0}par\ql", LtrContent))
            .AppendLine(textPara)
            .AppendLine(@"\par}");

            var expectString = sb.ToString();

            var rtfParagraph = new RtfParagraph(true, true);

            rtfParagraph.setText(textPara);
            var result = rtfParagraph.render();

            Assert.AreEqual(expectString, result);
        }