action.actionPerformed(new ActionEvent(pane, 0, null));
assertTrue(listener.occured);
}
public void testInsertHRAction() throws Exception {
InsertHTMLTextAction action = (InsertHTMLTextAction)findActionWithName(
editorKit.getActions(), "InsertHR");
assertNotNull(action);
JEditorPane pane = new JEditorPane();
pane.setEditorKit(editorKit);
document = ((HTMLDocument)pane.getDocument());
document.setAsynchronousLoadPriority(-1); // synchronous loading
pane.setText("<p>test</p>");
final int pos = document.getLength() - 1;
pane.setCaretPosition(pos);
action.actionPerformed(new ActionEvent(pane, 0, null));
Element e = document.getCharacterElement(pos + 1);
assertEquals(HTML.Tag.HR, getHTMLTagByElement(e));
assertNotNull(e);
HTML.Tag parentTag = getHTMLTagByElement(e.getParentElement());
assertTrue(HTML.Tag.P.equals(parentTag) || HTML.Tag.IMPLIED.equals(parentTag));