Changeset 12551 in josm for trunk/test


Ignore:
Timestamp:
2017-08-01T13:23:02+02:00 (7 years ago)
Author:
bastiK
Message:

fix AbstractMapRendererPerformanceTestParent (see #11924)

set up NavigatableComponent, so something is drawn

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java

    r10907 r12551  
    55import java.awt.Graphics2D;
    66import java.awt.image.BufferedImage;
     7import java.awt.Point;
    78import java.io.File;
    89import java.io.FileInputStream;
     
    1617import org.junit.rules.Timeout;
    1718import org.openstreetmap.josm.JOSMFixture;
    18 import org.openstreetmap.josm.Main;
    1919import org.openstreetmap.josm.data.Bounds;
    2020import org.openstreetmap.josm.data.osm.DataSet;
     
    5555        img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
    5656        g = (Graphics2D) img.getGraphics();
    57         g.setClip(0, 0, IMG_WIDTH, IMG_WIDTH);
     57        g.setClip(0, 0, IMG_WIDTH, IMG_HEIGHT);
    5858        g.setColor(Color.BLACK);
    59         g.fillRect(0, 0, IMG_WIDTH, IMG_WIDTH);
    60         nc = Main.map.mapView;
    61         nc.setBounds(0, 0, IMG_WIDTH, IMG_HEIGHT);
     59        g.fillRect(0, 0, IMG_WIDTH, IMG_HEIGHT);
     60        nc = new NavigatableComponent() {
     61            {
     62                setBounds(0, 0, IMG_WIDTH, IMG_HEIGHT);
     63                updateLocationState();
     64            }
     65
     66            @Override
     67            protected boolean isVisibleOnScreen() {
     68                return true;
     69            }
     70
     71            @Override
     72            public Point getLocationOnScreen() {
     73                return new Point(0, 0);
     74            }
     75        };
     76
     77        // Force reset of preferences
     78        StyledMapRenderer.PREFERENCE_ANTIALIASING_USE.put(true);
     79        StyledMapRenderer.PREFERENCE_TEXT_ANTIALIASING.put("gasp");
    6280
    6381        try (
     
    84102
    85103    protected final void test(int iterations, DataSet ds, Bounds bounds) throws Exception {
     104        nc.zoomTo(bounds);
    86105        Rendering visitor = buildRenderer();
    87         nc.zoomTo(bounds);
    88106        for (int i = 0; i < iterations; i++) {
    89107            visitor.render(ds, true, bounds);
Note: See TracChangeset for help on using the changeset viewer.