Changeset 7142 in josm
- Timestamp:
- 2014-05-18T18:04:18+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.groovy
r7141 r7142 8 8 9 9 import org.junit.* 10 import org.openstreetmap.josm.JOSMFixture 10 11 import org.openstreetmap.josm.Main 11 12 import org.openstreetmap.josm.data.Bounds … … 13 14 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer 14 15 import org.openstreetmap.josm.gui.MainApplication 15 import org.openstreetmap.josm.gui. layer.OsmDataLayer16 import org.openstreetmap.josm.gui.NavigatableComponent 16 17 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles 17 18 import org.openstreetmap.josm.gui.preferences.SourceEntry 19 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences 18 20 import org.openstreetmap.josm.io.Compression 19 21 import org.openstreetmap.josm.io.OsmReader … … 27 29 28 30 /* ------------------------ configuration section ---------------------------- */ 29 /**30 * The path to the JOSM home environment31 */32 def static JOSM_HOME="test/config/performance-josm.home"33 34 31 /** 35 32 * The path to the style file used for rendering. … … 46 43 47 44 def static boolean checkTestEnvironment() { 48 File f = new File(JOSM_HOME) 49 if (!f.isDirectory() || !f.exists()) { 50 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.") 51 } 52 53 f = new File(STYLE_FILE); 45 File f = new File(STYLE_FILE); 54 46 if ( !f.isFile() || ! f.exists()) { 55 47 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.") … … 58 50 59 51 @BeforeClass 60 public static void createJOSMFixture() {61 checkTestEnvironment()62 System.setProperty("josm.home", JOSM_HOME)63 MainApplication.main(new String[0])52 public static void createJOSMFixture() { 53 JOSMFixture.createPerformanceTestFixture().init(); 54 Main.toolbar = new ToolbarPreferences(); 55 new MainApplication(); 64 56 } 65 57 … … 71 63 } 72 64 73 def 65 def loadStyle() { 74 66 print "Loading style '$STYLE_FILE' ..." 75 67 MapCSSStyleSource source = new MapCSSStyleSource( … … 93 85 print "Loading data file '$DATA_FILE' ..." 94 86 ds = OsmReader.parseDataSet(Compression.getUncompressedFileInputStream(new File(DATA_FILE)), null); 95 Main.main.addLayer(new OsmDataLayer(ds,"test layer",null /* no file */));96 87 println "DONE" 97 88 } … … 102 93 loadData() 103 94 104 def mv = Main.map.mapView105 95 NavigatableComponent mv = new NavigatableComponent(); 96 mv.setBounds(0, 0, 1024, 768) 106 97 BufferedImage img = new BufferedImage(mv.getWidth(), mv.getHeight(), BufferedImage.TYPE_3BYTE_BGR) 107 98 Graphics2D g = img.createGraphics() 108 99 g.setClip(0,0, mv.getWidth(), mv.getHeight()) 109 def visitor = new StyledMapRenderer(g, Main.map.mapView, false)100 StyledMapRenderer visitor = new StyledMapRenderer(g, mv, false) 110 101 111 102 print "Rendering ..."
Note:
See TracChangeset
for help on using the changeset viewer.