3 <script type="text/javascript" src="../../lib/OpenLayers.js"></script>
4 <script type="text/javascript">
6 // use an arcims map service against Avencia Inc.'s global sample map services
7 var serviceName = "OpenLayers_Sample";
8 var layerName = "Global Sample Map";
9 var imsUrl = "http://sample.avencia.com/servlet/com.esri.esrimap.Esrimap";
12 // create an arcims layer
14 function test_Layer_ArcIMS_constructor( t ) {
18 serviceName: serviceName,
20 displayOutsideMaxExtent: true
23 var layer = new OpenLayers.Layer.ArcIMS( layerName, imsUrl, options );
25 // check layer & properties
26 t.ok( layer instanceof OpenLayers.Layer.ArcIMS, "new OpenLayers.Layer.ArcIMS returns object" );
27 t.eq( layer.url, imsUrl, "layer.url is correct (HTTPRequest inited)" );
28 t.eq( layer.name, layerName, "layer.name is correct" );
29 t.eq( layer.displayOutsideMaxExtent, options.displayOutsideMaxExtent,
30 "displayOutsideMaxExtent property set correctly from options" );
32 // check request parameters
33 t.eq( layer.params.ServiceName, serviceName, "ServiceName set properly" );
34 t.eq( layer.params.ClientVersion, "9.2", "ClientVersion set properly" );
36 // check request options
37 t.eq( layer.options.async, options.async, "async property set correctly from options" );
38 t.eq( layer.options.serviceName, serviceName, "serviceName property set correctly from options" );
39 t.eq( layer.options.layers.length, 0, "layers option is the correct length" );
40 t.eq( layer.options.tileSize.w, 512, "default tile width set correctly" );
41 t.eq( layer.options.tileSize.h, 512, "default tile height set correctly" );
47 * how to test getURL, getURLasync, and getFeatureInfo without a proxy?
53 // Create an arcims layer, and verify that the query changes properly
55 function test_Layer_ArcIMS_setLayerQuery(t) {
58 var options = { serviceName: serviceName };
59 var layer = new OpenLayers.Layer.ArcIMS( layerName, imsUrl, options );
61 where: "FIPS_CNTRY = 'US'"
64 t.eq( layer.options.layers.length, 0, "layer definitions are empty" );
66 layer.setLayerQuery( "layerID", querydef );
68 t.eq( layer.options.layers.length, 1, "layers definitions contain one layerdef" );
69 t.ok( layer.options.layers[0].query !== null, "layer query exists" );
70 t.eq( typeof layer.options.layers[0].query.where, "string", "where query is a string" );
71 t.eq( layer.options.layers[0].query.where, querydef.where, "where query matches" );
73 // change the definition
75 where: "FIPS_CNTRY = 'UV'",
79 layer.setLayerQuery( "layerID", querydef );
81 t.eq( layer.options.layers.length, 1, "layers definitions contain one layerdef" );
82 t.ok( layer.options.layers[0].query !== null, "layer query exists" );
83 t.eq( typeof layer.options.layers[0].query.where, "string", "where query is a string" );
84 t.eq( layer.options.layers[0].query.where, querydef.where, "where query matches" );