mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
Implemented (trivial) tests for dispose.
This commit is contained in:
parent
7867aeae76
commit
7435c12a80
@ -893,32 +893,32 @@ public abstract class ImageReaderAbstractTestCase<T extends ImageReader> {
|
|||||||
TestData data = getTestData().get(0);
|
TestData data = getTestData().get(0);
|
||||||
reader.setInput(data.getInputStream());
|
reader.setInput(data.getInputStream());
|
||||||
|
|
||||||
float aspect = 0f;
|
float aspectRatio = 0f;
|
||||||
try {
|
try {
|
||||||
aspect = reader.getAspectRatio(0);
|
aspectRatio = reader.getAspectRatio(0);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
fail("Could not read image aspectratio" + e);
|
fail("Could not read image aspect ratio" + e);
|
||||||
}
|
}
|
||||||
Dimension d = data.getDimension(0);
|
Dimension d = data.getDimension(0);
|
||||||
assertEquals("Wrong aspect aspectratio", d.getWidth() / d.getHeight(), aspect, 0.001);
|
assertEquals("Wrong aspect aspect ratio", d.getWidth() / d.getHeight(), aspectRatio, 0.001);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAspectRatioNoInput() {
|
public void testGetAspectRatioNoInput() {
|
||||||
ImageReader reader = createReader();
|
ImageReader reader = createReader();
|
||||||
|
|
||||||
float aspect = 0f;
|
float aspectRatio = 0f;
|
||||||
try {
|
try {
|
||||||
aspect = reader.getAspectRatio(0);
|
aspectRatio = reader.getAspectRatio(0);
|
||||||
fail("aspect read without imput");
|
fail("aspect read without input");
|
||||||
}
|
}
|
||||||
catch (IllegalStateException ignore) {
|
catch (IllegalStateException ignore) {
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
fail("Could not read image aspectratio" + e);
|
fail("Could not read image aspect ratio" + e);
|
||||||
}
|
}
|
||||||
assertEquals("Wrong aspect aspectratio", 0f, aspect, 0f);
|
assertEquals("Wrong aspect aspect ratio", 0f, aspectRatio, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -927,24 +927,32 @@ public abstract class ImageReaderAbstractTestCase<T extends ImageReader> {
|
|||||||
TestData data = getTestData().get(0);
|
TestData data = getTestData().get(0);
|
||||||
reader.setInput(data.getInputStream());
|
reader.setInput(data.getInputStream());
|
||||||
|
|
||||||
//float aspectratio = 0f;
|
//float aspectRatio = 0f;
|
||||||
try {
|
try {
|
||||||
// NOTE: Some readers (like the com.sun.imageio stuff) ignores
|
// NOTE: Some readers (like the com.sun.imageio stuff) ignores
|
||||||
// index in getWidth/getHeight for formats with only one image...
|
// index in getWidth/getHeight for formats with only one image...
|
||||||
/*aspectratio =*/ reader.getAspectRatio(-1);
|
/*aspectRatio =*/ reader.getAspectRatio(-1);
|
||||||
//assertEquals("Wrong aspectratio aspectratio", data.getDimension().width / (float) data.getDimension().height, aspectratio, 0f);
|
//assertEquals("Wrong aspect ratio", data.getDimension().width / (float) data.getDimension().height, aspectRatio, 0f);
|
||||||
}
|
}
|
||||||
catch (IndexOutOfBoundsException ignore) {
|
catch (IndexOutOfBoundsException expected) {
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
fail("Could not read image aspectratio" + e);
|
fail("Could not read image aspect ratio" + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("Not implemented")
|
|
||||||
@Test
|
@Test
|
||||||
public void testDispose() {
|
public void testDisposeBeforeRead() {
|
||||||
// TODO: Implement
|
ImageReader reader = createReader();
|
||||||
|
reader.dispose(); // Just pass with no exceptions
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDisposeAfterRead() {
|
||||||
|
ImageReader reader = createReader();
|
||||||
|
TestData data = getTestData().get(0);
|
||||||
|
reader.setInput(data.getInputStream());
|
||||||
|
reader.dispose(); // Just pass with no exceptions
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -1433,13 +1441,17 @@ public abstract class ImageReaderAbstractTestCase<T extends ImageReader> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void testSetDestinationBands() throws IOException {
|
@Ignore("TODO: Implement")
|
||||||
// throw new UnsupportedOperationException("Method testSetDestinationBands not implemented"); // TODO: Implement
|
@Test
|
||||||
// }
|
public void testSetDestinationBands() throws IOException {
|
||||||
//
|
throw new UnsupportedOperationException("Method testSetDestinationBands not implemented"); // TODO: Implement
|
||||||
// public void testSetSourceBands() throws IOException {
|
}
|
||||||
// throw new UnsupportedOperationException("Method testSetDestinationBands not implemented"); // TODO: Implement
|
|
||||||
// }
|
@Ignore("TODO: Implement")
|
||||||
|
@Test
|
||||||
|
public void testSetSourceBands() throws IOException {
|
||||||
|
throw new UnsupportedOperationException("Method testSetDestinationBands not implemented"); // TODO: Implement
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProviderAndMetadataFormatNamesMatch() throws IOException {
|
public void testProviderAndMetadataFormatNamesMatch() throws IOException {
|
||||||
@ -1459,7 +1471,6 @@ public abstract class ImageReaderAbstractTestCase<T extends ImageReader> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected URL getClassLoaderResource(final String pName) {
|
protected URL getClassLoaderResource(final String pName) {
|
||||||
return getClass().getResource(pName);
|
return getClass().getResource(pName);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user