From 3cf66a577901c0ec30a452bf21be727d714dc74c Mon Sep 17 00:00:00 2001 From: crschmidt Date: Thu, 5 Oct 2006 19:31:00 +0000 Subject: [PATCH] Documentation and tests to close #259 . git-svn-id: http://svn.openlayers.org/trunk/openlayers@1605 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- doc/Util.txt | 1 + tests/test_Util.html | 9 +++++++++ 2 files changed, 10 insertions(+) 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 ''."); + } // -->