82 for (int x = x1; x < x2; x++) { 83 int actual = bi.getRGB(x, y); 84 if (actual != expected) { 85 throw new RuntimeException("Test failed for " + name + 86 " region at x="+x+" y="+y+ 87 " (expected="+ 88 Integer.toHexString(expected) + 89 " actual="+ 90 Integer.toHexString(actual) + 91 ")"); 92 } 93 } 94 } 95 } 96 97 public static void main(String[] args) { 98 boolean show = (args.length == 1) && ("-show".equals(args[0])); 99 100 CopyAreaOOB test = new CopyAreaOOB(); 101 Frame frame = new Frame(); 102 frame.add(test); 103 frame.pack(); 104 frame.setVisible(true); 105 106 // Wait until the component's been painted 107 synchronized (test) { 108 while (!done) { 109 try { 110 test.wait(); 111 } catch (InterruptedException e) { 112 throw new RuntimeException("Failed: Interrupted"); 113 } 114 } 115 } 116 117 try { 118 Thread.sleep(2000); 119 } catch (InterruptedException ex) {} 120 121 // Grab the screen region 122 BufferedImage capture = null; 123 try { | 82 for (int x = x1; x < x2; x++) { 83 int actual = bi.getRGB(x, y); 84 if (actual != expected) { 85 throw new RuntimeException("Test failed for " + name + 86 " region at x="+x+" y="+y+ 87 " (expected="+ 88 Integer.toHexString(expected) + 89 " actual="+ 90 Integer.toHexString(actual) + 91 ")"); 92 } 93 } 94 } 95 } 96 97 public static void main(String[] args) { 98 boolean show = (args.length == 1) && ("-show".equals(args[0])); 99 100 CopyAreaOOB test = new CopyAreaOOB(); 101 Frame frame = new Frame(); 102 frame.setUndecorated(true); 103 frame.add(test); 104 frame.pack(); 105 frame.setLocationRelativeTo(null); 106 frame.setVisible(true); 107 108 // Wait until the component's been painted 109 synchronized (test) { 110 while (!done) { 111 try { 112 test.wait(); 113 } catch (InterruptedException e) { 114 throw new RuntimeException("Failed: Interrupted"); 115 } 116 } 117 } 118 119 try { 120 Thread.sleep(2000); 121 } catch (InterruptedException ex) {} 122 123 // Grab the screen region 124 BufferedImage capture = null; 125 try { |