Changeset 9907 in josm for trunk/test/unit/org
- Timestamp:
- 2016-03-01T23:35:29+01:00 (9 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 5 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/TestUtils.java
r9529 r9907 4 4 import static org.junit.Assert.fail; 5 5 6 import java.awt.Canvas; 7 import java.awt.Color; 6 8 import java.awt.Component; 9 import java.awt.Composite; 10 import java.awt.Font; 11 import java.awt.FontMetrics; 12 import java.awt.Graphics; 13 import java.awt.Graphics2D; 14 import java.awt.GraphicsConfiguration; 15 import java.awt.Image; 16 import java.awt.Paint; 17 import java.awt.Rectangle; 18 import java.awt.RenderingHints; 19 import java.awt.RenderingHints.Key; 20 import java.awt.Shape; 21 import java.awt.Stroke; 22 import java.awt.font.FontRenderContext; 23 import java.awt.font.GlyphVector; 24 import java.awt.geom.AffineTransform; 25 import java.awt.image.BufferedImage; 26 import java.awt.image.BufferedImageOp; 27 import java.awt.image.ImageObserver; 28 import java.awt.image.RenderedImage; 29 import java.awt.image.renderable.RenderableImage; 7 30 import java.io.File; 8 31 import java.io.IOException; 9 32 import java.io.InputStream; 33 import java.text.AttributedCharacterIterator; 10 34 import java.util.Arrays; 11 35 import java.util.Comparator; 36 import java.util.Map; 12 37 13 38 import org.openstreetmap.josm.gui.progress.AbstractProgressMonitor; … … 196 221 return null; 197 222 } 198 199 223 }; 200 224 } 225 226 // CHECKSTYLE.OFF: AnonInnerLength 227 // CHECKSTYLE.OFF: MethodLength 228 // CHECKSTYLE.OFF: ParameterNumber 229 230 /** 231 * Returns an instance of {@link Graphics2D}. 232 * @return a mockup graphics instance 233 */ 234 public static Graphics2D newGraphics() { 235 return new Graphics2D() { 236 237 @Override 238 public void setXORMode(Color c1) { 239 } 240 241 @Override 242 public void setPaintMode() { 243 } 244 245 @Override 246 public void setFont(Font font) { 247 } 248 249 @Override 250 public void setColor(Color c) { 251 } 252 253 @Override 254 public void setClip(int x, int y, int width, int height) { 255 } 256 257 @Override 258 public void setClip(Shape clip) { 259 } 260 261 @Override 262 public FontMetrics getFontMetrics(Font f) { 263 return new Canvas().getFontMetrics(getFont()); 264 } 265 266 @Override 267 public Font getFont() { 268 return new Font(null, 0, 0); 269 } 270 271 @Override 272 public Color getColor() { 273 return null; 274 } 275 276 @Override 277 public Rectangle getClipBounds() { 278 return null; 279 } 280 281 @Override 282 public Shape getClip() { 283 return null; 284 } 285 286 @Override 287 public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { 288 } 289 290 @Override 291 public void fillRect(int x, int y, int width, int height) { 292 } 293 294 @Override 295 public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) { 296 } 297 298 @Override 299 public void fillOval(int x, int y, int width, int height) { 300 } 301 302 @Override 303 public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { 304 } 305 306 @Override 307 public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { 308 } 309 310 @Override 311 public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) { 312 } 313 314 @Override 315 public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) { 316 } 317 318 @Override 319 public void drawOval(int x, int y, int width, int height) { 320 } 321 322 @Override 323 public void drawLine(int x1, int y1, int x2, int y2) { 324 } 325 326 @Override 327 public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, 328 Color bgcolor, ImageObserver observer) { 329 return false; 330 } 331 332 @Override 333 public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, 334 ImageObserver observer) { 335 return false; 336 } 337 338 @Override 339 public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) { 340 return false; 341 } 342 343 @Override 344 public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { 345 return false; 346 } 347 348 @Override 349 public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) { 350 return false; 351 } 352 353 @Override 354 public boolean drawImage(Image img, int x, int y, ImageObserver observer) { 355 return false; 356 } 357 358 @Override 359 public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { 360 } 361 362 @Override 363 public void dispose() { 364 } 365 366 @Override 367 public Graphics create() { 368 return this; 369 } 370 371 @Override 372 public void copyArea(int x, int y, int width, int height, int dx, int dy) { 373 } 374 375 @Override 376 public void clipRect(int x, int y, int width, int height) { 377 } 378 379 @Override 380 public void clearRect(int x, int y, int width, int height) { 381 } 382 383 @Override 384 public void translate(double tx, double ty) { 385 } 386 387 @Override 388 public void translate(int x, int y) { 389 } 390 391 @Override 392 public void transform(AffineTransform Tx) { 393 } 394 395 @Override 396 public void shear(double shx, double shy) { 397 } 398 399 @Override 400 public void setTransform(AffineTransform Tx) { 401 } 402 403 @Override 404 public void setStroke(Stroke s) { 405 } 406 407 @Override 408 public void setRenderingHints(Map<?, ?> hints) { 409 } 410 411 @Override 412 public void setRenderingHint(Key hintKey, Object hintValue) { 413 } 414 415 @Override 416 public void setPaint(Paint paint) { 417 } 418 419 @Override 420 public void setComposite(Composite comp) { 421 } 422 423 @Override 424 public void setBackground(Color color) { 425 } 426 427 @Override 428 public void scale(double sx, double sy) { 429 } 430 431 @Override 432 public void rotate(double theta, double x, double y) { 433 } 434 435 @Override 436 public void rotate(double theta) { 437 } 438 439 @Override 440 public boolean hit(Rectangle rect, Shape s, boolean onStroke) { 441 return false; 442 } 443 444 @Override 445 public AffineTransform getTransform() { 446 return null; 447 } 448 449 @Override 450 public Stroke getStroke() { 451 return null; 452 } 453 454 @Override 455 public RenderingHints getRenderingHints() { 456 return null; 457 } 458 459 @Override 460 public Object getRenderingHint(Key hintKey) { 461 return null; 462 } 463 464 @Override 465 public Paint getPaint() { 466 return null; 467 } 468 469 @Override 470 public FontRenderContext getFontRenderContext() { 471 return null; 472 } 473 474 @Override 475 public GraphicsConfiguration getDeviceConfiguration() { 476 return null; 477 } 478 479 @Override 480 public Composite getComposite() { 481 return null; 482 } 483 484 @Override 485 public Color getBackground() { 486 return null; 487 } 488 489 @Override 490 public void fill(Shape s) { 491 } 492 493 @Override 494 public void drawString(AttributedCharacterIterator iterator, float x, float y) { 495 } 496 497 @Override 498 public void drawString(AttributedCharacterIterator iterator, int x, int y) { 499 } 500 501 @Override 502 public void drawString(String str, float x, float y) { 503 } 504 505 @Override 506 public void drawString(String str, int x, int y) { 507 } 508 509 @Override 510 public void drawRenderedImage(RenderedImage img, AffineTransform xform) { 511 } 512 513 @Override 514 public void drawRenderableImage(RenderableImage img, AffineTransform xform) { 515 } 516 517 @Override 518 public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) { 519 } 520 521 @Override 522 public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) { 523 return false; 524 } 525 526 @Override 527 public void drawGlyphVector(GlyphVector g, float x, float y) { 528 } 529 530 @Override 531 public void draw(Shape s) { 532 } 533 534 @Override 535 public void clip(Shape s) { 536 } 537 538 @Override 539 public void addRenderingHints(Map<?, ?> hints) { 540 } 541 }; 542 } 543 544 // CHECKSTYLE.ON: ParameterNumber 545 // CHECKSTYLE.ON: MethodLength 546 // CHECKSTYLE.ON: AnonInnerLength 201 547 }
Note:
See TracChangeset
for help on using the changeset viewer.