Changeset 11776 in josm
- Timestamp:
- 2017-03-25T22:01:59+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java
r11276 r11776 11 11 import java.util.IdentityHashMap; 12 12 13 import org.junit.AfterClass; 13 14 import org.junit.Assert; 15 import org.junit.Before; 14 16 import org.junit.BeforeClass; 17 import org.junit.Rule; 15 18 import org.junit.Test; 16 19 import org.openstreetmap.josm.JOSMFixture; … … 21 24 import org.openstreetmap.josm.data.osm.visitor.paint.Rendering; 22 25 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 26 import org.openstreetmap.josm.gui.MapView; 23 27 import org.openstreetmap.josm.gui.NavigatableComponent; 24 28 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 25 29 import org.openstreetmap.josm.io.Compression; 26 30 import org.openstreetmap.josm.io.OsmReader; 31 import org.openstreetmap.josm.testutils.JOSMTestRules; 27 32 import org.openstreetmap.josm.tools.Pair; 33 34 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 28 35 29 36 /** … … 41 48 private static DataSet dsCity2; 42 49 50 /** 51 * The test rules used for this test. 52 */ 53 @Rule 54 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 55 public JOSMTestRules test = new JOSMTestRules().preferences().platform().projection(); 56 57 /** 58 * Load the test data that is required. 59 * @throws Exception 60 */ 43 61 @BeforeClass 44 62 public static void load() throws Exception { 45 JOSMFixture.createPerformanceTestFixture().init(true);46 63 img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB); 47 g = (Graphics2D) img.getGraphics();48 g.setClip(0, 0, IMG_WIDTH, IMG_WIDTH);49 g.setColor(Color.BLACK);50 g.fillRect(0, 0, IMG_WIDTH, IMG_WIDTH);51 nc = Main.map.mapView;52 nc.setBounds(0, 0, IMG_WIDTH, IMG_HEIGHT);53 64 54 MapPaintStyles.readFromPreferences();55 65 try ( 56 66 InputStream fisC = Compression.getUncompressedFileInputStream(new File("data_nodist/neubrandenburg.osm.bz2")); … … 58 68 dsCity = OsmReader.parseDataSet(fisC, NullProgressMonitor.INSTANCE); 59 69 } 60 try ( 61 InputStream fisC = Compression.getUncompressedFileInputStream(new File("data_nodist/neubrandenburg.osm.bz2")); 62 ) { 63 dsCity2 = OsmReader.parseDataSet(fisC, NullProgressMonitor.INSTANCE); 64 } 70 dsCity2 = new DataSet(dsCity); 71 } 72 73 /** 74 * Free the memory allocated for this test. 75 * <p> 76 * Since we are running junit in non-forked mode, we don't know when this test will not be referenced any more. 77 */ 78 @AfterClass 79 public static void unload() { 80 g = null; 81 img = null; 82 nc = null; 83 dsCity = null; 84 dsCity2 = null; 85 } 86 87 /** 88 * Create the temporary graphics 89 */ 90 @Before 91 public void loadGraphicComponents() { 92 g = (Graphics2D) img.getGraphics(); 93 g.setClip(0, 0, IMG_WIDTH, IMG_WIDTH); 94 g.setColor(Color.BLACK); 95 g.fillRect(0, 0, IMG_WIDTH, IMG_WIDTH); 96 nc = new MapView(Main.getLayerManager(), null); 97 nc.setBounds(0, 0, IMG_WIDTH, IMG_HEIGHT); 98 MapPaintStyles.readFromPreferences(); 65 99 } 66 100 … … 79 113 @Test 80 114 public void testStyleCacheInternPool() { 115 // This can be removed if there was no dependency on Main.map in some MapCSS conditions. See #14572 116 JOSMFixture.createFunctionalTestFixture().init(true); 117 81 118 Bounds bounds = new Bounds(53.56, 13.25, 53.57, 13.26); 82 119 Rendering visitor = new StyledMapRenderer(g, nc, false); … … 105 142 @Test 106 143 public void testStyleCacheInternPool2() { 144 // This can be removed if there was no dependency on Main.map in some MapCSS conditions. See #14572 145 JOSMFixture.createFunctionalTestFixture().init(true); 146 107 147 Bounds bounds = new Bounds(53.56, 13.25, 53.57, 13.26); 108 148 Rendering visitor = new StyledMapRenderer(g, nc, false);
Note:
See TracChangeset
for help on using the changeset viewer.