/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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 4832224 6322584 6328478 6328481 6322580 6588884 6587863
* @summary Verifies that the pixelization of simple primitives (drawLine,
* fillRect, drawRect, fill, draw) with the OGL pipeline enabled
* matches that produced by our software loops. (The primitives tested here
* are simple enough that the OGL results should match the software results
* exactly.) There is some overlap with PolyVertTest as we test both
* solid and XOR rendering here, but this testcase is a bit simpler and
* more appropriate for quick OGL testing. This test is also useful for
* @author campbelc
*/
private static boolean done;
private static boolean testVI;
// Grab the screen region
try {
} catch (Exception e) {
e.printStackTrace();
}
}
private static final int[][] rpts = {
{2, 0, 0, 0},
{12, 0, 1, 0},
{22, 0, 0, 1},
{32, 0, 1, 1},
{42, 0, 2, 1},
{52, 0, 1, 2},
{62, 0, 2, 2},
{72, 0, 5, 5},
{82, 0, 10, 10},
{97, 0, 15, 15},
};
}
}
}
}
}
}
// use fill() instead of fillOval(), since the former is more
// likely to be consistent with our software loops when the
// OGL pipeline cannot be enabled
}
}
// use draw() instead of drawOval(), since the former is more
// likely to be consistent with our software loops when the
// OGL pipeline cannot be enabled
}
}
// drawLine tests...
drawLines(g, 1);
drawLines(g, 4);
// fillRect tests...
fillRects(g);
// drawRect tests...
drawRects(g);
// fillOval tests...
fillOvals(g);
// drawOval tests...
drawOvals(g);
}
// on the left side, render the shapes in solid mode
renderShapes(g);
// on the right side, render the shapes in XOR mode
renderShapes(g);
renderShapes(g);
}
synchronized (this) {
if (!done) {
doCapture(this);
done = true;
}
notifyAll();
}
}
}
boolean show = false;
testVI = true;
show = true;
}
}
frame.setVisible(true);
// Wait until the component's been painted
synchronized (test) {
while (!done) {
try {
} catch (InterruptedException e) {
throw new RuntimeException("Failed: Interrupted");
}
}
}
// REMIND: We will allow this test to pass silently on Windows
// (when OGL is not enabled) until we fix the GDI pipeline so that
// 6322554). This check should be removed when 6322554 is fixed.
"test considered PASSED");
return;
}
if (testVI) {
// render to a VI instead of the screen
do {
} while (vi.contentsLost());
}
if (!show) {
}
throw new RuntimeException("Error capturing the rendering");
}
// Create reference image
test.renderTest(g, w, h);
g.dispose();
// Test pixels
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
try {
} catch (IOException ex) {}
" (expected="+
" actual="+
")");
}
}
}
}
}