2212N/A/*
2362N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2212N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2212N/A *
2212N/A * This code is free software; you can redistribute it and/or modify it
2212N/A * under the terms of the GNU General Public License version 2 only, as
2212N/A * published by the Free Software Foundation.
2212N/A *
2212N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2212N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2212N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2212N/A * version 2 for more details (a copy is included in the LICENSE file that
2212N/A * accompanied this code).
2212N/A *
2212N/A * You should have received a copy of the GNU General Public License version
2212N/A * 2 along with this work; if not, write to the Free Software Foundation,
2212N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2212N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
2212N/A */
2212N/A
2212N/A/* @test
2212N/A @bug 6933784
2212N/A @summary NIMBUS: ImageView getNoImageIcon and getLoadingImageIcon returns nulls instead of an icon
2212N/A @author Pavel Porvatov
2212N/A @run main Test6933784
2212N/A*/
2212N/A
2212N/Aimport javax.swing.*;
2212N/Aimport javax.swing.plaf.nimbus.NimbusLookAndFeel;
2212N/Aimport javax.swing.plaf.synth.SynthLookAndFeel;
2212N/Aimport javax.swing.text.Element;
2212N/Aimport javax.swing.text.html.HTMLDocument;
2212N/Aimport javax.swing.text.html.HTMLEditorKit;
2212N/Aimport javax.swing.text.html.ImageView;
2212N/Aimport java.io.StringReader;
2212N/A
2212N/Apublic class Test6933784 {
2212N/A public static void main(String[] args) throws Exception {
2212N/A UIManager.setLookAndFeel(new SynthLookAndFeel());
2212N/A
2212N/A checkImages();
2212N/A
2212N/A UIManager.setLookAndFeel(new NimbusLookAndFeel());
2212N/A
2212N/A checkImages();
2212N/A }
2212N/A
2212N/A private static void checkImages() throws Exception {
2212N/A SwingUtilities.invokeAndWait(new Runnable() {
2212N/A public void run() {
2212N/A HTMLEditorKit c = new HTMLEditorKit();
2212N/A HTMLDocument doc = new HTMLDocument();
2212N/A
2212N/A try {
2212N/A c.read(new StringReader("<HTML><TITLE>Test</TITLE><BODY><IMG id=test></BODY></HTML>"), doc, 0);
2212N/A } catch (Exception e) {
2212N/A throw new RuntimeException("The test failed", e);
2212N/A }
2212N/A
2212N/A Element elem = doc.getElement("test");
2212N/A ImageView iv = new ImageView(elem);
2212N/A
2212N/A if (iv.getLoadingImageIcon() == null) {
2212N/A throw new RuntimeException("getLoadingImageIcon returns null");
2212N/A }
2212N/A
2212N/A if (iv.getNoImageIcon() == null) {
2212N/A throw new RuntimeException("getNoImageIcon returns null");
2212N/A }
2212N/A }
2212N/A });
2212N/A }
2212N/A}