140 if (h < minH || h > maxH ) {
141 incH = -incH;
142 }
143 frame.setSize(w, h);
144 cnt = 0;
145 }
146
147 // try to put the device into non-default state, for example,
148 // this operation below will set the transform
149 vi.validate(gc);
150 Graphics2D vig = (Graphics2D)vi.getGraphics();
151 vig.rotate(30.0f, vi.getWidth()/2, vi.getHeight()/2);
152 vig.drawImage(output, 0, 0,
153 vi.getWidth(), vi.getHeight(), null);
154
155 Insets in = frame.getInsets();
156 frame.getGraphics().drawImage(output, in.left, in.top, null);
157 if (cnt == 90 && robot != null) {
158 // area where we blitted to should be either white or green
159 Point p = frame.getLocationOnScreen();
160 p.move(in.left+10, in.top+10);
161 BufferedImage bi =
162 robot.createScreenCapture(
163 new Rectangle(p.x, p.y, IMAGE_W/2, IMAGE_H/2));
164 int accepted1[] = { Color.white.getRGB(), Color.green.getRGB()};
165 checkBI(bi, accepted1);
166
167 // the are where we didn't render should stay white
168 p = frame.getLocationOnScreen();
169 p.move(in.left, in.top+IMAGE_H+5);
170 bi = robot.createScreenCapture(
171 new Rectangle(p.x, p.y,
172 frame.getWidth()-in.left-in.right,
173 frame.getHeight()-in.top-in.bottom-5-IMAGE_H));
174 int accepted2[] = { Color.white.getRGB() };
175 checkBI(bi, accepted1);
176 }
177
178 Thread.yield();
179 }
180 frame.dispose();
181 System.out.println("Test Passed");
182 }
183
184 private static void checkBI(BufferedImage bi, int accepted[]) {
185 for (int x = 0; x < bi.getWidth(); x++) {
186 for (int y = 0; y < bi.getHeight(); y++) {
187 int pix = bi.getRGB(x, y);
188 boolean found = false;
189 for (int acc : accepted) {
|
140 if (h < minH || h > maxH ) {
141 incH = -incH;
142 }
143 frame.setSize(w, h);
144 cnt = 0;
145 }
146
147 // try to put the device into non-default state, for example,
148 // this operation below will set the transform
149 vi.validate(gc);
150 Graphics2D vig = (Graphics2D)vi.getGraphics();
151 vig.rotate(30.0f, vi.getWidth()/2, vi.getHeight()/2);
152 vig.drawImage(output, 0, 0,
153 vi.getWidth(), vi.getHeight(), null);
154
155 Insets in = frame.getInsets();
156 frame.getGraphics().drawImage(output, in.left, in.top, null);
157 if (cnt == 90 && robot != null) {
158 // area where we blitted to should be either white or green
159 Point p = frame.getLocationOnScreen();
160 p.translate(in.left+10, in.top+10);
161 BufferedImage bi =
162 robot.createScreenCapture(
163 new Rectangle(p.x, p.y, IMAGE_W/2, IMAGE_H/2));
164 int accepted1[] = { Color.white.getRGB(), Color.green.getRGB()};
165 checkBI(bi, accepted1);
166
167 // the are where we didn't render should stay white
168 p = frame.getLocationOnScreen();
169 p.translate(in.left, in.top+IMAGE_H+5);
170 bi = robot.createScreenCapture(
171 new Rectangle(p.x, p.y,
172 frame.getWidth()-in.left-in.right,
173 frame.getHeight()-in.top-in.bottom-5-IMAGE_H));
174 int accepted2[] = { Color.white.getRGB() };
175 checkBI(bi, accepted1);
176 }
177
178 Thread.yield();
179 }
180 frame.dispose();
181 System.out.println("Test Passed");
182 }
183
184 private static void checkBI(BufferedImage bi, int accepted[]) {
185 for (int x = 0; x < bi.getWidth(); x++) {
186 for (int y = 0; y < bi.getHeight(); y++) {
187 int pix = bi.getRGB(x, y);
188 boolean found = false;
189 for (int acc : accepted) {
|