public void TestGetSDTs() { String[] contents = new String[] { "header_rich_text", "Rich_text", "Rich_text_pre_table\nRich_text_cell1\t\t\t\n\t\t\t\n\t\t\t\n\nRich_text_post_table", "Plain_text_no_newlines", "Plain_text_with_newlines1\nplain_text_with_newlines2", "Watermelon", "Dirt", "4/16/2013", "Rich_text_in_cell", "rich_text_in_paragraph_in_cell", "Footer_rich_text", "Footnote_sdt", "Endnote_sdt" }; XWPFDocument doc = XWPFTestDataSamples.OpenSampleDocument("Bug54849.docx"); List <AbstractXWPFSDT> sdts = ExtractAllSDTs(doc); Assert.AreEqual(contents.Length, sdts.Count, "number of sdts"); for (int i = 0; i < contents.Length; i++) {//contents.Length; i++){ AbstractXWPFSDT sdt = sdts[i]; Assert.AreEqual(contents[i], sdt.Content.ToString(), i + ": " + contents[i]); } }
public void TestNewLinesBetweenRuns() { XWPFDocument doc = XWPFTestDataSamples.OpenSampleDocument("Bug55142.docx"); List <AbstractXWPFSDT> sdts = ExtractAllSDTs(doc); List <String> targs = new List <String>(); //these test newlines and tabs in paragraphs/body elements targs.Add("Rich-text1 abcdefghi"); targs.Add("Rich-text2 abcd\t\tefgh"); targs.Add("Rich-text3 abcd\nefg"); targs.Add("Rich-text4 abcdefg"); targs.Add("Rich-text5 abcdefg\nhijk"); targs.Add("Plain-text1 abcdefg"); targs.Add("Plain-text2 abcdefg\nhijk\nlmnop"); //this tests consecutive runs within a cell (not a paragraph) //this test case was triggered by Tika-1130 targs.Add("sdt_incell2 abcdefg"); for (int i = 0; i < sdts.Count; i++) { AbstractXWPFSDT sdt = sdts[i]; Assert.AreEqual(targs[i], sdt.Content.Text, targs[i]); } }