Ignore:
Timestamp:
2017-12-02T15:13:32+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #15599 - Improvements for testing painting (last patches by ris)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/org/openstreetmap/josm/gui/MapViewState.java

    r13175 r13181  
    33
    44import java.awt.Container;
     5import java.awt.GraphicsEnvironment;
    56import java.awt.Point;
    67import java.awt.geom.AffineTransform;
     
    145146
    146147    private static Point findTopLeftOnScreen(JComponent position) {
    147         try {
    148             return position.getLocationOnScreen();
    149         } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) {
    150             throw BugReport.intercept(e).put("position", position).put("parent", position::getParent);
     148        if (GraphicsEnvironment.isHeadless()) {
     149            // in our imaginary universe the window is always (10, 10) from the top left of the screen
     150            Point topLeftInWindow = findTopLeftInWindow(position);
     151            return new Point(topLeftInWindow.x + 10, topLeftInWindow.y + 10);
     152        } else {
     153            try {
     154                return position.getLocationOnScreen();
     155            } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) {
     156                throw BugReport.intercept(e).put("position", position).put("parent", position::getParent);
     157            }
    151158        }
    152159    }
Note: See TracChangeset for help on using the changeset viewer.