/* * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
/* * @test * @bug 6334602 * @summary Test verifies that when we create GIF image from Opaque PNG images * it should not be transparent. * @modules java.desktop/com.sun.imageio.plugins.gif * @run main/manual OpaquePNGToGIFTest
*/
public OpaquePNGToGIFTest() throws Exception {
SwingUtilities.invokeAndWait(() -> { try {
startTest();
} catch (Exception ex) {
Logger.getLogger(OpaquePNGToGIFTest.class.getName()).
log(Level.SEVERE, null, ex);
}
});
mainThread = Thread.currentThread(); try { Thread.sleep(60000);
} catch (InterruptedException e) { if (!testPassed && testGeneratedInterrupt) { thrownew RuntimeException("Test failed or didnt run"
+ " properly");
}
} if (!testGeneratedInterrupt) { if (img != null) {
img.flush();
}
instructionFrame.dispose(); if (startButtonClicked) {
imageFrame.dispose();
}
fos.close();
Files.delete(outputFile.toPath()); thrownew RuntimeException("user has not executed the test");
}
}
publicvoid startTest() throws Exception {
instructionFrame = new Frame();
dialog = new JDialog(instructionFrame);
dialog.setTitle("Instruction Dialog");
layout = new GridBagLayout();
mainControlPanel = new JPanel(layout);
resultButtonPanel = new JPanel(layout);
canvasPanel = new JPanel();
GridBagConstraints gbc = new GridBagConstraints();
String instructions
= " INSTRUCTIONS:
"
+ "After clicking on Start Test button you will see Red "
+ " circle drawn with light blue background, if the circle "
+ " color changes from Red to Green then press button Fail, "
+ " if it stays Red then press button Pass.
";
instructionText = new JLabel();
instructionText.setText(instructions);
public GIFImageMetadata setAnimationProperties(IIOMetadata data) {
ArrayList appIDs = new ArrayList();
appIDs.add(new String("NETSCAPE").getBytes());
ArrayList authCodes = new ArrayList();
authCodes.add(new String("2.0").getBytes());
ArrayList appData = new ArrayList(); byte[] authData = {1, 0, 0};
appData.add(authData);
GIFImageMetadata gifData = (GIFImageMetadata) data;
gifData.delayTime = 200; // If we set disposalMethod to 2 then only the issue is reproduced.
gifData.disposalMethod = 2;
gifData.userInputFlag = false;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.