assertEquals(0, leaf1.getElementCount());
}
public void testLeafElement() {
doc.writeLock();
AbstractDocument.LeafElement leaf = doc.new LeafElement(leaf1, as[2], 3, 9);
assertSame(leaf1, leaf.getParent());
assertSame(leaf1, leaf.getParentElement());
assertSame(leaf, leaf.getAttributes());
assertEquals(as[2].getAttributeCount(), leaf.getAttributeCount());
assertEquals(3, leaf.getStartOffset());
assertEquals(9, leaf.getEndOffset());
int[] start = { -1, 3, 3, 3 }; // start offset
int[] expStart = { 0, 3, 3, 3 }; // expectations for start offset
int[] end = { 9, -1, 1, 20 }; // end offset
int[] expEnd = { 9, 0, 1, 20 }; // expectations for end offset
int[] intEnd = { 9, 3, 3, 20 }; // expectations for our end offset
for (int i = 0; i < start.length; i++) {
leaf = doc.new LeafElement(null, null, start[i], end[i]);
assertEquals("Start (" + i + ")", expStart[i], leaf.getStartOffset());
assertEquals("End (" + i + ")", BasicSwingTestCase.isHarmony() ? intEnd[i]
: expEnd[i], leaf.getEndOffset());
}
doc.writeUnlock();
}