Example #1
0
        public void TestContents()
        {
            HWPFDocument doc = docAscii;

            for (int run = 0; run < 3; run++)
            {
                Range r;

                // Now check the real ranges
                r = doc.GetRange();
                Assert.AreEqual(
                    a_page_1 +
                    page_break + "\r" +
                    a_page_2,
                    r.Text
                    );

                r = doc.GetHeaderStoryRange();
                Assert.AreEqual(
                    headerDef +
                    a_header +
                    footerDef +
                    a_footer +
                    endHeaderFooter,
                    r.Text
                    );

                r = doc.GetOverallRange();
                Assert.AreEqual(
                    a_page_1 +
                    page_break + "\r" +
                    a_page_2 +
                    headerDef +
                    a_header +
                    footerDef +
                    a_footer +
                    endHeaderFooter +
                    "\r",
                    r.Text
                    );

                // Write out and read back in again, Ready for
                //  the next run of the Test
                // TODO run more than once
                if (run < 1)
                {
                    doc = HWPFTestDataSamples.WriteOutAndReadBack(doc);
                }
            }
        }
Example #2
0
        public void TestBasicsUnicode()
        {
            HWPFDocument doc = docUnicode;

            for (int run = 0; run < 3; run++)
            {
                // First check the start and end bits
                Assert.AreEqual(
                    0,
                    doc._cpSplit.GetMainDocumentStart()
                    );
                Assert.AreEqual(
                    u_page_1.Length +
                    2 +     // page break
                    u_page_2.Length,
                    doc._cpSplit.GetMainDocumentEnd()
                    );

                Assert.AreEqual(
                    408,
                    doc._cpSplit.GetFootnoteStart()
                    );
                Assert.AreEqual(
                    408,
                    doc._cpSplit.GetFootnoteEnd()
                    );

                Assert.AreEqual(
                    408,
                    doc._cpSplit.GetHeaderStoryStart()
                    );
                // TODO - fix this one
                Assert.AreEqual(
                    408 + headerDef.Length + u_header.Length +
                    footerDef.Length + u_footer.Length + endHeaderFooter.Length,
                    doc._cpSplit.GetHeaderStoryEnd()
                    );

                // Write out and read back in again, Ready for
                //  the next run of the Test
                // TODO run more than once
                if (run < 1)
                {
                    doc = HWPFTestDataSamples.WriteOutAndReadBack(doc);
                }
            }
        }