Changeset 16983 in josm for trunk/test
- Timestamp:
- 2020-08-30T21:08:19+02:00 (4 years ago)
- Location:
- trunk/test/functional/org/openstreetmap/josm/tools
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java
r16982 r16983 10 10 import static org.openstreetmap.josm.gui.mappaint.MapCSSRendererTest.assertImageEquals; 11 11 12 import java.awt.Color;13 12 import java.awt.Dimension; 14 import java.awt.Graphics;15 13 import java.awt.GraphicsEnvironment; 16 import java.awt.GridLayout;17 14 import java.awt.Image; 18 15 import java.awt.Point; 19 16 import java.awt.Toolkit; 20 17 import java.awt.Transparency; 21 import java.awt.event.MouseEvent;22 import java.awt.event.MouseListener;23 18 import java.awt.image.BufferedImage; 24 19 import java.io.File; … … 32 27 33 28 import javax.swing.ImageIcon; 34 import javax.swing.JFrame;35 import javax.swing.JPanel;36 29 37 30 import org.junit.Before; 38 31 import org.junit.BeforeClass; 39 import org.junit.Ignore;40 32 import org.junit.Rule; 41 33 import org.junit.Test; … … 161 153 162 154 /** 163 * Test fetching an image using {@code wiki://} protocol.164 */165 @Test166 public void testWikiProtocol() {167 // https://commons.wikimedia.org/wiki/File:OpenJDK_logo.svg168 assertNotNull(ImageProvider.get("wiki://OpenJDK_logo.svg"));169 }170 171 /**172 155 * Test fetching an image using {@code data:} URL. 173 156 */ … … 309 292 } 310 293 311 312 /**313 * Test getting a cursor314 */315 @Ignore("manual execution only, as the look of the cursor cannot be checked automatedly")316 @Test317 public void testGetCursor() throws InterruptedException {318 JFrame frame = new JFrame();319 frame.setSize(500, 500);320 frame.setLayout(new GridLayout(2, 2));321 JPanel leftUpperPanel = new JPanel(), rightUpperPanel = new JPanel(), leftLowerPanel = new JPanel(), rightLowerPanel = new JPanel();322 leftUpperPanel.setBackground(Color.DARK_GRAY);323 rightUpperPanel.setBackground(Color.DARK_GRAY);324 leftLowerPanel.setBackground(Color.DARK_GRAY);325 rightLowerPanel.setBackground(Color.DARK_GRAY);326 frame.add(leftUpperPanel);327 frame.add(rightUpperPanel);328 frame.add(leftLowerPanel);329 frame.add(rightLowerPanel);330 331 leftUpperPanel.setCursor(ImageProvider.getCursor("normal", "select_add")); // contains diagonal sensitive to alpha blending332 rightUpperPanel.setCursor(ImageProvider.getCursor("crosshair", "joinway")); // combination of overlay and hotspot not top left333 leftLowerPanel.setCursor(ImageProvider.getCursor("hand", "parallel_remove")); // reasonably nice bitmap cursor334 rightLowerPanel.setCursor(ImageProvider.getCursor("rotate", null)); // ugly bitmap cursor, cannot do much here335 336 frame.setVisible(true);337 338 // hover over the four quadrant to observe different cursors339 340 // draw red dot at hotspot when clicking341 frame.addMouseListener(new MouseListener() {342 @Override343 public void mouseClicked(MouseEvent e) {344 Graphics graphics = frame.getGraphics();345 graphics.setColor(Color.RED);346 graphics.drawRect(e.getX(), e.getY(), 1, 1);347 }348 349 @Override350 public void mousePressed(MouseEvent e) { }351 352 @Override353 public void mouseReleased(MouseEvent e) { }354 355 @Override356 public void mouseEntered(MouseEvent e) { }357 358 @Override359 public void mouseExited(MouseEvent e) { }360 });361 Thread.sleep(9000); // test would time out after 10s362 }363 294 }
Note:
See TracChangeset
for help on using the changeset viewer.