Thanks for the killer effort from David Zwarg from Avencia in building this, and for Tim Schaub from OpenGeo for his excellent review. r=me,tschaub (Closes #213) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9249 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
89 lines
3.5 KiB
HTML
89 lines
3.5 KiB
HTML
<html>
|
|
<head>
|
|
<script type="text/javascript" src="../../lib/OpenLayers.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
// use an arcims map service against Avencia Inc.'s global sample map services
|
|
var serviceName = "OpenLayers_Sample";
|
|
var layerName = "Global Sample Map";
|
|
var imsUrl = "http://sample.avencia.com/servlet/com.esri.esrimap.Esrimap";
|
|
|
|
//
|
|
// create an arcims layer
|
|
//
|
|
function test_Layer_ArcIMS_constructor( t ) {
|
|
t.plan(11);
|
|
|
|
var options = {
|
|
serviceName: serviceName,
|
|
async: false,
|
|
displayOutsideMaxExtent: true
|
|
};
|
|
|
|
var layer = new OpenLayers.Layer.ArcIMS( layerName, imsUrl, options );
|
|
|
|
// check layer & properties
|
|
t.ok( layer instanceof OpenLayers.Layer.ArcIMS, "new OpenLayers.Layer.ArcIMS returns object" );
|
|
t.eq( layer.url, imsUrl, "layer.url is correct (HTTPRequest inited)" );
|
|
t.eq( layer.name, layerName, "layer.name is correct" );
|
|
t.eq( layer.displayOutsideMaxExtent, options.displayOutsideMaxExtent,
|
|
"displayOutsideMaxExtent property set correctly from options" );
|
|
|
|
// check request parameters
|
|
t.eq( layer.params.ServiceName, serviceName, "ServiceName set properly" );
|
|
t.eq( layer.params.ClientVersion, "9.2", "ClientVersion set properly" );
|
|
|
|
// check request options
|
|
t.eq( layer.options.async, options.async, "async property set correctly from options" );
|
|
t.eq( layer.options.serviceName, serviceName, "serviceName property set correctly from options" );
|
|
t.eq( layer.options.layers.length, 0, "layers option is the correct length" );
|
|
t.eq( layer.options.tileSize.w, 512, "default tile width set correctly" );
|
|
t.eq( layer.options.tileSize.h, 512, "default tile height set correctly" );
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
* how to test getURL, getURLasync, and getFeatureInfo without a proxy?
|
|
*
|
|
*/
|
|
|
|
|
|
//
|
|
// Create an arcims layer, and verify that the query changes properly
|
|
//
|
|
function test_Layer_ArcIMS_setLayerQuery(t) {
|
|
t.plan(9);
|
|
|
|
var options = { serviceName: serviceName };
|
|
var layer = new OpenLayers.Layer.ArcIMS( layerName, imsUrl, options );
|
|
var querydef = {
|
|
where: "FIPS_CNTRY = 'US'"
|
|
};
|
|
|
|
t.eq( layer.options.layers.length, 0, "layer definitions are empty" );
|
|
|
|
layer.setLayerQuery( "layerID", querydef );
|
|
|
|
t.eq( layer.options.layers.length, 1, "layers definitions contain one layerdef" );
|
|
t.ok( layer.options.layers[0].query !== null, "layer query exists" );
|
|
t.eq( typeof layer.options.layers[0].query.where, "string", "where query is a string" );
|
|
t.eq( layer.options.layers[0].query.where, querydef.where, "where query matches" );
|
|
|
|
// change the definition
|
|
querydef = {
|
|
where: "FIPS_CNTRY = 'UV'",
|
|
spatialfilter:true
|
|
}
|
|
|
|
layer.setLayerQuery( "layerID", querydef );
|
|
|
|
t.eq( layer.options.layers.length, 1, "layers definitions contain one layerdef" );
|
|
t.ok( layer.options.layers[0].query !== null, "layer query exists" );
|
|
t.eq( typeof layer.options.layers[0].query.where, "string", "where query is a string" );
|
|
t.eq( layer.options.layers[0].query.where, querydef.where, "where query matches" );
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
</html> |