Exemple #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());
        }
Exemple #2
0
        public void TestDefaultCharFormatProperty()
        {
            var text         = "Test Paragraph";
            var rtfParagraph = new RtfParagraph(true, true);

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

            rtfParagraph.setText(text);
            Assert.DoesNotThrow(() => rtfParagraph.addFootnote(1));
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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));
        }
Exemple #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());
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }