Beispiel #1
0
        public void TestUnicodeParagraphDefInitions()
        {
            Range r = u.GetRange();

            String[] p1_parts = u_page_1.Split('\r');
            String[] p2_parts = u_page_2.Split('\r');

            Assert.AreEqual(
                u_page_1 + page_break + "\r" + u_page_2,
                r.Text
                );
            Assert.AreEqual(
                408, r.Text.Length
                );


            Assert.AreEqual(1, r.NumSections);
            Assert.AreEqual(1, u.SectionTable.GetSections().Count);
            Section s = r.GetSection(0);

            Assert.AreEqual(
                u_page_1 +
                page_break + "\r" +
                u_page_2,
                s.Text
                );
            Assert.AreEqual(0, s.StartOffset);
            Assert.AreEqual(408, s.EndOffset);


            List <PAPX> pDefs = r._paragraphs;

            Assert.AreEqual(35, pDefs.Count);

            // Check that the last paragraph ends where it should do
            Assert.AreEqual(531, u.GetOverallRange().Text.Length);
            Assert.AreEqual(530, u.GetCPSplitCalculator().GetHeaderTextboxEnd());
            PropertyNode pLast = (PropertyNode)pDefs[34];
            //		Assert.AreEqual(530, pLast.End);

            // Only care about the first few really though
            PropertyNode p0 = (PropertyNode)pDefs[0];
            PropertyNode p1 = (PropertyNode)pDefs[1];
            PropertyNode p2 = (PropertyNode)pDefs[2];
            PropertyNode p3 = (PropertyNode)pDefs[3];
            PropertyNode p4 = (PropertyNode)pDefs[4];

            // 5 paragraphs should get us to the end of our text
            Assert.IsTrue(p0.Start < 408);
            Assert.IsTrue(p0.End < 408);
            Assert.IsTrue(p1.Start < 408);
            Assert.IsTrue(p1.End < 408);
            Assert.IsTrue(p2.Start < 408);
            Assert.IsTrue(p2.End < 408);
            Assert.IsTrue(p3.Start < 408);
            Assert.IsTrue(p3.End < 408);
            Assert.IsTrue(p4.Start < 408);
            Assert.IsTrue(p4.End < 408);

            // Paragraphs should match with lines
            Assert.AreEqual(
                0,
                p0.Start
                );
            Assert.AreEqual(
                p1_parts[0].Length + 1,
                p0.End
                );

            Assert.AreEqual(
                p1_parts[0].Length + 1,
                p1.Start
                );
            Assert.AreEqual(
                p1_parts[0].Length + 1 +
                p1_parts[1].Length + 1,
                p1.End
                );

            Assert.AreEqual(
                p1_parts[0].Length + 1 +
                p1_parts[1].Length + 1,
                p2.Start
                );
            Assert.AreEqual(
                p1_parts[0].Length + 1 +
                p1_parts[1].Length + 1 +
                p1_parts[2].Length + 1,
                p2.End
                );
        }