* @param harness the test harness to use
*/
void testInsertModifiedAttributes(TestHarness harness)
{
harness.checkPoint("insertModifiedAttributes");
DefaultStyledDocument doc = new DefaultStyledDocument();
prepareDocument(doc);
SimpleAttributeSet atts = new SimpleAttributeSet();
// Insert 5 (different from the rest) characters at pos 5.
StyleConstants.setForeground(atts, Color.RED);
try
{
doc.insertString(5, "12345", atts);
}
catch (BadLocationException ex)
{
harness.debug(ex);
}
// Now we should have the following child elements below the single
// root and single paragraph: (0, 5) (5, 10) (10, 21)
Element root = doc.getDefaultRootElement();
harness.check(root.getStartOffset(), 0);
harness.check(root.getEndOffset(), 21);
harness.check(root.getElementCount(), 1);
Element par = root.getElement(0);