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