Revision 30754 branches/v2_0_0_prep/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManagerTest.java
DefaultMapContextManagerTest.java | ||
---|---|---|
30 | 30 |
import java.awt.image.BufferedImage; |
31 | 31 |
import java.util.Map; |
32 | 32 |
|
33 |
import junit.framework.TestCase; |
|
34 |
|
|
35 | 33 |
import org.cresques.cts.ICoordTrans; |
36 | 34 |
import org.gvsig.compat.print.PrintAttributes; |
37 | 35 |
import org.gvsig.fmap.crs.CRSFactory; |
... | ... | |
52 | 50 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener; |
53 | 51 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent; |
54 | 52 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
55 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
|
|
53 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
|
|
56 | 54 |
import org.gvsig.tools.observer.Observer; |
57 | 55 |
import org.gvsig.tools.persistence.PersistenceException; |
58 | 56 |
import org.gvsig.tools.persistence.PersistentState; |
... | ... | |
61 | 59 |
/** |
62 | 60 |
* @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a> |
63 | 61 |
*/ |
64 |
public class DefaultMapContextManagerTest extends TestCase { |
|
62 |
public class DefaultMapContextManagerTest extends |
|
63 |
AbstractLibraryAutoInitTestCase { |
|
65 | 64 |
|
66 | 65 |
private DefaultMapContextManager manager; |
67 |
|
|
68 |
protected void setUp() throws Exception { |
|
69 |
super.setUp(); |
|
70 |
|
|
71 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
66 |
|
|
67 |
protected void doSetUp() throws Exception { |
|
72 | 68 |
manager = new DefaultMapContextManager(); |
73 | 69 |
} |
74 | 70 |
|
... | ... | |
82 | 78 |
* . |
83 | 79 |
*/ |
84 | 80 |
public void testGetDefaultMapContextDrawerInstance() throws Exception { |
85 |
|
|
81 |
|
|
86 | 82 |
manager.setDefaultMapContextDrawer(DummyMapContextDrawer.class); |
87 | 83 |
|
88 | 84 |
MapContextDrawer drawer = manager |
... | ... | |
116 | 112 |
manager.setDefaultMapContextDrawer(DummyMapContextDrawer.class); |
117 | 113 |
} |
118 | 114 |
|
119 |
public void testCreateGraphicsLayer() throws Exception {
|
|
115 |
public void testCreateGraphicsLayer() throws Exception { |
|
120 | 116 |
assertNotNull(manager.createGraphicsLayer(CRSFactory.getCRS("EPSG:23030"))); |
121 | 117 |
} |
122 | 118 |
|
123 | 119 |
public void testCreateDefaultVectorLegend() throws Exception { |
124 |
|
|
120 |
|
|
125 | 121 |
manager.registerLegend("DummyLegend", DummyVectorLegend.class); |
126 | 122 |
manager.setDefaultVectorLegend("DummyLegend"); |
127 | 123 |
|
... | ... | |
131 | 127 |
} |
132 | 128 |
|
133 | 129 |
public void testRegisterCreateLegend() throws Exception { |
134 |
|
|
130 |
|
|
135 | 131 |
manager.registerLegend("DummyLegend", DummyVectorLegend.class); |
136 | 132 |
|
137 | 133 |
ILegend legend = manager.createLegend("DummyLegend"); |
... | ... | |
142 | 138 |
} |
143 | 139 |
|
144 | 140 |
public void testRegisterCreateLegendReader() throws Exception { |
145 |
|
|
141 |
|
|
146 | 142 |
manager.registerLegendReader("Dummy", DummyLegendReader.class); |
147 | 143 |
|
148 |
ILegendReader legendReader = manager.createLegendReader("Dummy");
|
|
144 |
ILegendReader legendReader = manager.createLegendReader("Dummy"); |
|
149 | 145 |
assertNotNull(legendReader); |
150 | 146 |
assertTrue(legendReader instanceof DummyLegendReader); |
151 | 147 |
|
... | ... | |
153 | 149 |
} |
154 | 150 |
|
155 | 151 |
public void testRegisterCreateLegendWriter() throws Exception { |
156 |
|
|
152 |
|
|
157 | 153 |
manager.registerLegend("DummyLegend", DummyVectorLegend.class); |
158 | 154 |
|
159 | 155 |
manager.registerLegendWriter("DummyLegend", "Dummy", |
160 | 156 |
DummyLegendWriter.class); |
161 |
|
|
157 |
|
|
162 | 158 |
// Test the registered writer is created |
163 |
ILegendWriter legendWriter = manager.createLegendWriter("DummyLegend", "Dummy"); |
|
159 |
ILegendWriter legendWriter = manager.createLegendWriter("DummyLegend", |
|
160 |
"Dummy"); |
|
164 | 161 |
assertNotNull(legendWriter); |
165 | 162 |
assertTrue(legendWriter instanceof DummyLegendWriter); |
166 |
|
|
163 |
|
|
167 | 164 |
// Test non registered cases |
168 | 165 |
assertNull(manager.createLegendWriter("NONE", "Dummy")); |
169 | 166 |
assertNull(manager.createLegendWriter("DummyLegend", "NONE")); |
... | ... | |
198 | 195 |
public static class DummyLegendWriter implements ILegendWriter { |
199 | 196 |
|
200 | 197 |
} |
201 |
|
|
198 |
|
|
202 | 199 |
public static class DummyVectorLegend implements IVectorLegend { |
203 | 200 |
|
204 | 201 |
public void draw(BufferedImage image, Graphics2D graphics2d, |
... | ... | |
233 | 230 |
double scale, Map queryParameters, ICoordTrans coordTrans, |
234 | 231 |
FeatureStore featureStore, PrintAttributes properties) |
235 | 232 |
throws LegendException { |
236 |
// Empty method
|
|
233 |
// Empty method |
|
237 | 234 |
} |
238 | 235 |
|
239 | 236 |
public void setDefaultSymbol(ISymbol s) { |
Also available in: Unified diff