use of javax.swing.text.AbstractDocument.AbstractElement in project jdk8u_jdk by JetBrains.
the class bug7165725 method execute.
public void execute(final String urlStr, final GoldenElement goldenElement) throws Exception {
System.out.println();
System.out.println("***** TEST: " + urlStr + " *****");
System.out.println();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
editorPane = new JEditorPane();
editorPane.setEditorKit(new HTMLEditorKit() {
public Document createDefaultDocument() {
AbstractDocument doc = (AbstractDocument) super.createDefaultDocument();
doc.setAsynchronousLoadPriority(-1);
return doc;
}
});
editorPane.setPage(new URL(urlStr));
} catch (IOException ex) {
throw new RuntimeException("Test failed", ex);
}
editorPane.setEditable(false);
JScrollPane scroller = new JScrollPane();
JViewport vp = scroller.getViewport();
vp.add(editorPane);
add(scroller, BorderLayout.CENTER);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(400, 400);
setLocationRelativeTo(null);
setVisible(true);
}
});
((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
HTMLDocument doc = (HTMLDocument) editorPane.getDocument();
doc.dump(System.out);
goldenElement.checkStructureEquivalence((AbstractElement) doc.getDefaultRootElement());
dispose();
}
});
System.out.println();
System.out.println("*********************************");
System.out.println();
}
Aggregations