diff --git a/doc/Util.txt b/doc/Util.txt index 8e14fa816f..f2fb26a3e8 100644 --- a/doc/Util.txt +++ b/doc/Util.txt @@ -5,3 +5,4 @@ Utility class. Stores a bunch of methods and settings that don't fit anywhere el * Options OpenLayers.Util.onImageLoadErrorColor -- A string to set img.style.backgroundColor to if the onerror event fires for the image (useful for 500 errors from WMS, for example). + OpenLayers.ImgPath -- A string to be used as the base for images for controls and the like. Should end with '/'. diff --git a/tests/test_Util.html b/tests/test_Util.html index f7a843e451..266a1bcc85 100644 --- a/tests/test_Util.html +++ b/tests/test_Util.html @@ -479,7 +479,16 @@ resolution = OpenLayers.Util.getResolutionFromScale(scale); t.eq(OpenLayers.Util.getScaleFromResolution(resolution), scale, "scale->resolution->scale works"); } + function test_14_Util_getImgLocation(t) { + t.plan(3); + OpenLayers.ImgPath = "foo/"; + t.eq(OpenLayers.Util.getImagesLocation(), "foo/", "ImgPath works as expected."); + OpenLayers.ImgPath = null; + t.eq(OpenLayers.Util.getImagesLocation().substr(OpenLayers.Util.getImagesLocation().length-4,4), "img/", "ImgPath works as expected when not set."); + OpenLayers.ImgPath = ''; + t.eq(OpenLayers.Util.getImagesLocation().substr(OpenLayers.Util.getImagesLocation().length-4,4), "img/", "ImgPath works as expected when set to ''."); + } // -->