Ignore:
Timestamp:
2014-05-06T01:24:41+02:00 (10 years ago)
Author:
Don-vip
Message:

test cleanup

Location:
trunk/test/performance/org/openstreetmap/josm/gui
Files:
3 added
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.groovy

    r7065 r7068  
    1 
    21// License: GPL. For details, see LICENSE file.
    3 package mapcss.performance;
     2package org.openstreetmap.josm.gui.mappaint.mapcss;
    43
    54import static org.junit.Assert.*
     
    1615import org.openstreetmap.josm.gui.layer.OsmDataLayer
    1716import org.openstreetmap.josm.gui.mappaint.MapPaintStyles
    18 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource
    1917import org.openstreetmap.josm.gui.preferences.SourceEntry
    2018import org.openstreetmap.josm.io.OsmReader
    2119
    2220/**
    23  * This performance tests measures the time for a full run of MapPaintVisitor.visitAll()
     21 * This performance test measures the time for a full run of MapPaintVisitor.visitAll()
    2422 * against a test data set using a test style.
    25  * 
     23 *
    2624 */
    27 class PerformanceTest {
     25class MapCSSPerformanceTest {
    2826
    2927    /* ------------------------ configuration section  ---------------------------- */
    3028    /**
    31     * The path to the JOSM home environment
    32     */
    33    def static JOSM_HOME="/my/josm/home/dir"
    34    
    35    /**
    36     * The path to the style file used for rendering.
    37     */
    38    def static STYLE_FILE="/my/test-style.mapcss"
     29     * The path to the JOSM home environment
     30     */
     31    def static JOSM_HOME="test/config/performance-josm.home"
    3932
    40    /**
    41     * The data file to be rendered
    42     */
    43    def static DATA_FILE = "/my/test-data.osm"
    44     /* ------------------------ / configuration section  ---------------------------- */     
    45    
     33    /**
     34     * The path to the style file used for rendering.
     35     */
     36    def static STYLE_FILE="styles/standard/elemstyles.mapcss"
     37
     38    /**
     39     * The data file to be rendered
     40     */
     41    def static DATA_FILE = "/my/test-data.osm"
     42    /* ------------------------ / configuration section  ---------------------------- */
     43
    4644    def DataSet ds
    47    
     45
    4846    def static boolean checkTestEnvironment() {
    4947          File f = new File(JOSM_HOME)
    5048          if  (!f.isDirectory() || !f.exists()) {
    51               fail("JOSM_HOME refers to '${JOSM_HOME}. This is either not a directory or doesn't exist.\nPlease update configuration settings in the unit test file.")             
     49              fail("JOSM_HOME refers to '${JOSM_HOME}. This is either not a directory or doesn't exist.\nPlease update configuration settings in the unit test file.")
    5250          }
    53          
     51
    5452          f = new File(STYLE_FILE);
    5553          if ( !f.isFile() || ! f.exists()) {
    5654              fail("STYLE_FILE refers to '${STYLE_FILE}. This is either not a file or doesn't exist.\nPlease update configuration settings in the unit test file.")
    5755          }
    58          
     56
    5957          f = new File(DATA_FILE);
    6058          if ( !f.isFile() || ! f.exists()) {
     
    6260          }
    6361    }
    64    
     62
    6563    @BeforeClass
    6664    public static void createJOSMFixture(){
     
    6967        MainApplication.main(new String[0])
    7068    }
    71    
     69
    7270    def timed(Closure c){
    7371        long before = System.currentTimeMillis()
     
    7674        return after - before
    7775    }
    78    
     76
    7977    def  loadStyle() {
    8078        print "Loading style '$STYLE_FILE' ..."
     
    9593        println "DONE"
    9694    }
    97    
     95
    9896    def loadData() {
    9997        print "Loading data file '$DATA_FILE' ..."
     
    105103        println "DONE"
    106104    }
    107    
     105
    108106    @Test
    109107    public void measureTimeForStylePreparation() {
    110108        loadStyle()
    111109        loadData()
    112        
     110
    113111        def mv = Main.map.mapView
    114        
     112
    115113        BufferedImage img = mv.createImage(mv.getWidth(), mv.getHeight())
    116114        Graphics2D g = img.createGraphics()
    117115        g.setClip(0,0, mv.getWidth(), mv.getHeight())
    118         def visitor = new StyledMapRenderer()
    119         visitor.setNavigatableComponent(Main.map.mapView)
    120         visitor.setGraphics(g)
     116        def visitor = new StyledMapRenderer(g, Main.map.mapView, false)
    121117
    122118        print "Rendering ..."
     
    128124        println "style file: ${STYLE_FILE}"
    129125        println ""
    130         println "Rendering took $time ms."       
     126        println "Rendering took $time ms."
    131127    }
    132128}
Note: See TracChangeset for help on using the changeset viewer.