Changeset 9437 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-01-14T09:06:41+01:00 (9 years ago)
Author:
Don-vip
Message:

fix headless mode problem for imagery layer unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r9430 r9437  
    99import java.awt.Graphics;
    1010import java.awt.Graphics2D;
     11import java.awt.GraphicsEnvironment;
    1112import java.awt.GridBagLayout;
    1213import java.awt.Image;
     
    668669
    669670    protected int estimateTileCacheSize() {
    670         int height = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
    671         int width = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
     671        // Default screen size in headless mode, for unit tests
     672        int height = 800;
     673        int width = 600;
     674        if (!GraphicsEnvironment.isHeadless()) {
     675            height = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
     676            width = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
     677        }
    672678        int tileSize = 256; // default tile size
    673679        if (tileSource != null) {
Note: See TracChangeset for help on using the changeset viewer.