Index: modules/swing/src/test/api/java/common/javax/swing/text/ComponentViewTest.java =================================================================== --- modules/swing/src/test/api/java/common/javax/swing/text/ComponentViewTest.java (revision 453187) +++ modules/swing/src/test/api/java/common/javax/swing/text/ComponentViewTest.java (working copy) @@ -34,7 +34,11 @@ import javax.swing.JTextArea; import javax.swing.JTextPane; import javax.swing.SwingTestCase; +import javax.swing.text.Element; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.ListView; + public class ComponentViewTest extends SwingTestCase { StyledDocument document; @@ -729,7 +733,47 @@ assertSame(textPane, view.getComponent().getParent().getParent()); } } + public void testSetParent_View(){ + // Regression for HARMONY-1767 + HTMLDocument doc = new HTMLDocument(); + Element e=doc.getDefaultRootElement(); + ComponentView obj = new ComponentView(new testElement()); + obj.setParent(new ListView(e)); + } + private class testElement implements Element { + public boolean isLeaf() { + return false; + } + public Element getElement(int p0) { + return null; + } + public int getElementCount() { + return 0; + } + public int getElementIndex(int p0) { + return 0; + } + public int getEndOffset() { + return 0; + } + public int getStartOffset() { + return 0; + } + public AttributeSet getAttributes() { + return null; + } + public String getName() { + return "AA"; + } + public Element getParentElement() { + return null; + } + public Document getDocument() { + return null; + } + } + private void checkBounds(final int x, final int y, final int height, final Shape box) { Rectangle bounds = box.getBounds();