author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 41010 | jdk/test/javax/imageio/ReadAbortTest.java@9824689edeb1 |
permissions | -rw-r--r-- |
41010
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
1 |
/* |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
4 |
* |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
8 |
* |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
13 |
* accompanied this code). |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
14 |
* |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
18 |
* |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
21 |
* questions. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
22 |
*/ |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
23 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
24 |
/* |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
25 |
* @test |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
26 |
* @bug 4924727 |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
27 |
* @summary Test verifies that if we call ImageReader.abort() in |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
28 |
* IIOReadProgressListener.imageStarted() or |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
29 |
* IIOReadProgressListener.imageProgress() are we |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
30 |
* calling IIOReadProgressListener.readAborted() for all readers. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
31 |
* @run main ReadAbortTest |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
32 |
*/ |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
33 |
import java.awt.image.BufferedImage; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
34 |
import java.io.File; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
35 |
import java.util.Iterator; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
36 |
import javax.imageio.ImageIO; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
37 |
import javax.imageio.ImageReader; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
38 |
import javax.imageio.event.IIOReadProgressListener; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
39 |
import javax.imageio.stream.ImageInputStream; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
40 |
import java.awt.Color; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
41 |
import java.awt.Graphics2D; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
42 |
import java.nio.file.Files; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
43 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
44 |
public class ReadAbortTest implements IIOReadProgressListener { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
45 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
46 |
ImageReader reader = null; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
47 |
ImageInputStream iis = null; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
48 |
BufferedImage bimg = null; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
49 |
File file; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
50 |
boolean startAbort = false; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
51 |
boolean startAborted = false; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
52 |
boolean progressAbort = false; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
53 |
boolean progressAborted = false; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
54 |
Color srccolor = Color.red; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
55 |
int width = 100; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
56 |
int heght = 100; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
57 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
58 |
public ReadAbortTest(String format) throws Exception { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
59 |
try { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
60 |
System.out.println("Test for format " + format); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
61 |
bimg = new BufferedImage(width, heght, |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
62 |
BufferedImage.TYPE_INT_RGB); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
63 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
64 |
Graphics2D g = bimg.createGraphics(); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
65 |
g.setColor(srccolor); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
66 |
g.fillRect(0, 0, width, heght); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
67 |
g.dispose(); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
68 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
69 |
file = File.createTempFile("src_", "." + format, new File(".")); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
70 |
ImageIO.write(bimg, format, file); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
71 |
ImageInputStream iis = ImageIO.createImageInputStream(file); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
72 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
73 |
Iterator iter = ImageIO.getImageReaders(iis); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
74 |
while (iter.hasNext()) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
75 |
reader = (ImageReader) iter.next(); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
76 |
break; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
77 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
78 |
reader.setInput(iis); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
79 |
reader.addIIOReadProgressListener(this); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
80 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
81 |
// Abort reading in IIOReadProgressListener.imageStarted(). |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
82 |
startAbort = true; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
83 |
bimg = reader.read(0); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
84 |
startAbort = false; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
85 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
86 |
// Abort reading in IIOReadProgressListener.imageProgress(). |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
87 |
progressAbort = true; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
88 |
bimg = reader.read(0); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
89 |
progressAbort = false; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
90 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
91 |
iis.close(); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
92 |
/* |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
93 |
* All abort requests from imageStarted,imageProgress and |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
94 |
* imageComplete from IIOReadProgressListener should be reached |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
95 |
* otherwise throw RuntimeException. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
96 |
*/ |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
97 |
if (!(startAborted |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
98 |
&& progressAborted)) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
99 |
throw new RuntimeException("All IIOReadProgressListener abort" |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
100 |
+ " requests are not processed for format " |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
101 |
+ format); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
102 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
103 |
} catch (Exception e) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
104 |
throw e; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
105 |
} finally { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
106 |
Files.delete(file.toPath()); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
107 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
108 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
109 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
110 |
/* |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
111 |
* Abstract methods that we need to implement from |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
112 |
* IIOReadProgressListener, and relevant for this test case. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
113 |
*/ |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
114 |
@Override |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
115 |
public void imageStarted(ImageReader source, int imageIndex) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
116 |
System.out.println("imageStarted called"); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
117 |
if (startAbort) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
118 |
source.abort(); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
119 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
120 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
121 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
122 |
@Override |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
123 |
public void imageProgress(ImageReader source, float percentageDone) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
124 |
System.out.println("imageProgress called"); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
125 |
if (progressAbort) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
126 |
source.abort(); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
127 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
128 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
129 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
130 |
@Override |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
131 |
public void readAborted(ImageReader source) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
132 |
System.out.println("readAborted called"); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
133 |
// Verify IIOReadProgressListener.imageStarted() abort request. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
134 |
if (startAbort) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
135 |
System.out.println("imageStarted aborted "); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
136 |
startAborted = true; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
137 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
138 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
139 |
// Verify IIOReadProgressListener.imageProgress() abort request. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
140 |
if (progressAbort) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
141 |
System.out.println("imageProgress aborted "); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
142 |
progressAborted = true; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
143 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
144 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
145 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
146 |
public static void main(String args[]) throws Exception { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
147 |
final String[] formats = {"bmp", "png", "gif", "jpg", "tif"}; |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
148 |
for (String format : formats) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
149 |
new ReadAbortTest(format); |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
150 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
151 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
152 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
153 |
/* |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
154 |
* Remaining abstract methods that we need to implement from |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
155 |
* IIOReadProgressListener, but not relevant for this test case. |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
156 |
*/ |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
157 |
@Override |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
158 |
public void imageComplete(ImageReader source) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
159 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
160 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
161 |
@Override |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
162 |
public void sequenceStarted(ImageReader reader, int i) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
163 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
164 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
165 |
@Override |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
166 |
public void sequenceComplete(ImageReader reader) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
167 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
168 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
169 |
@Override |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
170 |
public void thumbnailStarted(ImageReader reader, int i, int i1) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
171 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
172 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
173 |
@Override |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
174 |
public void thumbnailProgress(ImageReader reader, float f) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
175 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
176 |
|
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
177 |
@Override |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
178 |
public void thumbnailComplete(ImageReader reader) { |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
179 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
180 |
} |
9824689edeb1
4924727: reader.abort() method does not work when called inside imageStarted for PNG
jdv
parents:
diff
changeset
|
181 |