mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-1380: Regression test java/awt/Graphics2D/DrawString/LCDTextSrcEa.java works incorrectly
This commit is contained in:
@@ -31,14 +31,20 @@
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.*;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class LCDTextSrcEa extends Component {
|
||||
|
||||
private static final int TIMEOUT = 20000;
|
||||
private static volatile boolean nongrey = false;
|
||||
private static CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
static int SZ=150;
|
||||
BufferedImage target =
|
||||
new BufferedImage(SZ, SZ, BufferedImage.TYPE_INT_RGB);
|
||||
|
||||
public static void main(String args[]) {
|
||||
public static void main(String args[]) throws InterruptedException {
|
||||
Frame f = new Frame("LCD Text SrcEa Test");
|
||||
f.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
@@ -50,6 +56,16 @@ public class LCDTextSrcEa extends Component {
|
||||
f.add("Center", td);
|
||||
f.pack();
|
||||
f.setVisible(true);
|
||||
|
||||
if(!latch.await(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||
throw new RuntimeException("ERROR: Test paint method has not finished for " + TIMEOUT + "msec");
|
||||
}
|
||||
|
||||
f.dispose();
|
||||
|
||||
if (!nongrey) {
|
||||
throw new RuntimeException("No LCD text found");
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
@@ -73,7 +89,7 @@ public class LCDTextSrcEa extends Component {
|
||||
g2d.setColor(Color.black);
|
||||
g2d.drawString("Some sample text.", 10, 20);
|
||||
gx.drawImage(target, 0, 0, null);
|
||||
boolean nongrey = false;
|
||||
|
||||
//Test BI: should be some non-greyscale color
|
||||
for (int px=0;px<SZ;px++) {
|
||||
for (int py=0;py<SZ;py++) {
|
||||
@@ -87,8 +103,6 @@ public class LCDTextSrcEa extends Component {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!nongrey) {
|
||||
throw new RuntimeException("No LCD text found");
|
||||
}
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user