/* * Copyright (c) 2001, 2017, 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 4395376 * @summary Performs various sanity checks on Spi class constructors and get * methods
*/
checkImageReaderSpiConstructor(true);
vendorName = "My Vendor";
checkImageReaderSpiConstructor(true);
version = "My Version";
checkImageReaderSpiConstructor(true);
names = new String[0];
checkImageReaderSpiConstructor(true);
names = new String[1];
names[0] = "My Format Name";
checkImageReaderSpiConstructor(true);
readerClassName = "com.mycompany.Reader";
checkImageReaderSpiConstructor(true);
inputTypes = newClass[0];
checkImageReaderSpiConstructor(true);
inputTypes = newClass[1];
inputTypes[0] = Object.class; // Now it should work
checkImageReaderSpiConstructor(false);
// Test normalization of zero-length arrays
suffixes = new String[0];
MIMETypes = new String[0];
writerSpiNames = new String[0];
extraStreamMetadataFormatNames = new String[0];
extraImageMetadataFormatNames = new String[0];
ImageReaderSpi spi = constructImageReaderSpi(); if (spi.getFileSuffixes() != null) {
error("Failed to normalize suffixes!");
} if (spi.getMIMETypes() != null) {
error("Failed to normalize MIMETypes!");
} if (spi.getImageWriterSpiNames() != null) {
error("Failed to normalize writerSpiNames!");
} if (spi.getExtraStreamMetadataFormatNames() != null) {
error("Failed to normalize extraStreamMetadataFormatNames!");
} if (spi.getExtraImageMetadataFormatNames() != null) {
error("Failed to normalize extraImageMetadataFormatNames!");
}
}
checkImageWriterSpiConstructor(true);
vendorName = "My Vendor";
checkImageWriterSpiConstructor(true);
version = "My Version";
checkImageWriterSpiConstructor(true);
names = new String[0];
checkImageWriterSpiConstructor(true);
names = new String[1];
names[0] = "My Format Name";
checkImageWriterSpiConstructor(true);
writerClassName = "com.mycompany.Writer";
checkImageWriterSpiConstructor(true);
outputTypes = newClass[0];
checkImageWriterSpiConstructor(true);
outputTypes = newClass[1];
outputTypes[0] = Object.class; // Now it should work
checkImageWriterSpiConstructor(false);
// Test normalization of zero-length arrays
suffixes = new String[0];
MIMETypes = new String[0];
readerSpiNames = new String[0];
extraStreamMetadataFormatNames = new String[0];
extraStreamMetadataFormatClassNames = new String[0];
extraImageMetadataFormatNames = new String[0];
extraImageMetadataFormatClassNames = new String[0];
ImageWriterSpi spi = constructImageWriterSpi(); if (spi.getFileSuffixes() != null) {
error("Failed to normalize suffixes!");
} if (spi.getMIMETypes() != null) {
error("Failed to normalize MIMETypes!");
} if (spi.getImageReaderSpiNames() != null) {
error("Failed to normalize readerSpiNames!");
} if (spi.getExtraStreamMetadataFormatNames() != null) {
error("Failed to normalize extraStreamMetadataFormatNames!");
} if (spi.getExtraImageMetadataFormatNames() != null) {
error("Failed to normalize extraImageMetadataFormatNames!");
}
}
public SpiTest() {
testImageReaderSpiConstructor();
testImageWriterSpiConstructor();
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 und die Messung sind noch experimentell.