test_Util.html 23.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
<html>
<head>
  <script src="../lib/OpenLayers.js"></script>
  <script type="text/javascript"><!--
    var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
    var map; 
    function test_01_Util_getImagesLocation (t) {
        t.plan( 1 );
        t.ok( OpenLayers.Util.getImagesLocation(), "../img/",
                    "getImagesLocation()" );
    }

    function test_02_Util_Strings(t) {
        t.plan(5);
        
        var str = "  chicken pox  ";

        t.ok(str.contains("chicken"), "contains() function correctly finds an embedded string");
        t.ok(!str.contains("marsupial"), "contains() function correctly does not finds an random string");
        

        var trimmedStr = str.trim();        

        t.eq(trimmedStr, "chicken pox", "String.trim works correctly");

        t.eq(trimmedStr.startsWith("chicken"), true, "String.startsWith correctly finds chicken");
        t.eq(trimmedStr.startsWith("dolphin"), false, "String.startsWith correctly does not find turkey");


    }

    function test_03_Util_Array(t) {
        t.plan( 2 );

        var array = new Array(1,2,3,4,5);

        OpenLayers.Util.removeItem(array, 3);
        t.eq( array.toString(), "1,2,4,5", "Util.removeItem works");    

        OpenLayers.Util.clearArray(array);
        t.eq( array.toString(), "", "Util.clearArray works");    
        
    }

    function test_04_Util_createDiv(t) {
        t.plan( 24 );

        var id = "boo";
        var px = new OpenLayers.Pixel(5,5);
        var sz = new OpenLayers.Size(10,10);
        var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
        var position = "absolute";
        var border = "13px solid";
        var overflow = "hidden";
        var opacity = 0.5;

        var div = OpenLayers.Util.createDiv(id, px, sz, img, position, border, overflow, opacity);

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
        t.eq( div.id, id, "div.id set correctly");    
        t.eq( div.style.left, px.x + "px", "div.style.left set correctly");    
        t.eq( div.style.top, px.y + "px", "div.style.top set correctly");    

        t.eq( div.style.width, sz.w + "px", "div.style.width set correctly");    
        t.eq( div.style.height, sz.h + "px", "div.style.height set correctly");    

        bImg = div.style.backgroundImage;
        imgCorrect = ( (bImg == "url(" + img + ")") ||  
                       (bImg == "url(\"" + img + "\")") );
        t.ok(imgCorrect, "div.style.backgroundImage correctly");    

        t.eq( div.style.position, position, "div.style.positionset correctly");    
        t.ok( (div.style.border.indexOf(border) != -1), "div.style.border set correctly");    
        t.eq( div.style.overflow, overflow, "div.style.overflow set correctly");    
        t.eq( parseFloat(div.style.opacity), opacity, "element.style.opacity set correctly");    
        var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
        t.eq( div.style.filter, filterString, "element.style.filter set correctly");

        //test defaults
        var div = OpenLayers.Util.createDiv();

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
        t.ok( (div.id != ""), "div.id set correctly");    
        t.eq(div.style.left, "", "div.style.left set correctly");    
        t.eq(div.style.top, "", "div.style.top set correctly");    

        t.eq( div.style.width, "", "div.style.width set correctly");    
        t.eq( div.style.height, "", "div.style.height set correctly");    

        t.eq(div.style.backgroundImage, "", "div.style.backgroundImage correctly");    

        t.eq( div.style.position, "absolute", "div.style.positionset correctly");    
        t.eq( div.style.border, "", "div.style.border set correctly");    
        t.eq(div.style.overflow, "", "div.style.overflow set correctly");    
        t.ok( !div.style.opacity, "element.style.opacity set correctly");    
        t.ok( !div.style.filter, "element.style.filter set correctly");

    }

    function test_05_Util_createImage(t) {
        t.plan( 22 );

        var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
        var sz = new OpenLayers.Size(10,10);
        var xy = new OpenLayers.Pixel(5,5);
        var position = "absolute";
        var id = "boo";
        var border = "1px solid";
        var opacity = 0.5;

        var image = OpenLayers.Util.createImage(id, xy, sz, img, position, border, opacity);

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
        t.eq( image.id, id, "image.id set correctly");    
        t.eq( image.style.left, xy.x + "px", "image.style.left set correctly");    
        t.eq( image.style.top, xy.y + "px", "image.style.top set correctly");    

        t.eq( image.style.width, sz.w + "px", "image.style.width set correctly");    
        t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");    

        t.ok( (image.style.border.indexOf(border) != -1), "image.style.border set correctly");    
        t.eq( image.src, img, "image.style.backgroundImage correctly");    
        t.eq( image.style.position, position, "image.style.position set correctly");    
        t.eq( parseFloat(image.style.opacity), opacity, "image.style.opacity set correctly");    
        var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
        t.eq( image.style.filter, filterString, "element.style.filter set correctly");

        //test defaults
        var image = OpenLayers.Util.createImage();

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( image.nodeName == "IMG", "createDiv creates a valid HTMLDivElement" );
        t.ok( (image.id != ""), "image.id set to something");    
        t.eq( image.style.left, "", "image.style.left set correctly");    
        t.eq( image.style.top, "", "image.style.top set correctly");    

        t.eq( image.style.width, "", "image.style.width set correctly");    
        t.eq( image.style.height, "", "image.style.height set correctly");    

        t.ok((image.style.border == ""), "image.style.border set correctly");    
        t.eq(image.src, "", "image.style.backgroundImage correctly");    
        t.eq( image.style.position, "relative", "image.style.positionset correctly");    
        t.ok( !image.style.opacity, "element.style.opacity default unset");    
        t.ok( !image.style.filter, "element.style.filter default unset");

    }

    function test_06_Util_applyDefaults(t) {
    
        t.plan(4);
        
        var to = { a: "abra",
                   b: "blorg"
                 };

        var from = { b: "zoink",
                     c: "press"
                   };

        OpenLayers.Util.applyDefaults(to, from);

        t.ok( to instanceof Object, " applyDefaults returns an object");
        t.eq( to["a"], "abra", "key present in to but not from maintained");
        t.eq( to["b"], "blorg", "key present in to and from, maintained in to");
        t.eq( to["c"], "press", "key present in from and not to successfully copied to to");
    }

    function test_07_Util_getParameterString(t) {
        t.plan( 4 );

        var params = { foo: "bar",
                       chicken: 1.5
                     }

        t.eq( OpenLayers.Util.getParameterString(params), "foo=bar&chicken=1.5", "getParameterString returns correctly");    
        t.eq( OpenLayers.Util.getParameterString({'a:':'b='}), "a%3A=b%3D", "getParameterString returns correctly with non-ascii keys/values");    
        

        // Parameters which are a list should end up being a comma-seperated
        // list of the URL encoded strings
        var params = { foo: ["bar,baz"] };
        t.eq( OpenLayers.Util.getParameterString(params), "foo=bar%2Cbaz", "getParameterString encodes , correctly in arrays");    
        
        var params = { foo: ["bar","baz,"] };
        t.eq( OpenLayers.Util.getParameterString(params), "foo=bar,baz%2C", "getParameterString returns with list of CSVs when given a list. ");    
    }

    function test_08_Util_createAlphaImageDiv(t) {
        t.plan( 19 );

        var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
        var sz = new OpenLayers.Size(10,10);
        var xy = new OpenLayers.Pixel(5,5);
        var position = "absolute";
        var id = "boo";
        var border = "1px solid";
        var sizing = "crop";
        var opacity = 0.5;

        var imageDiv = OpenLayers.Util.createAlphaImageDiv(id, xy, sz, img, position, border, sizing, opacity);

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( imageDiv instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );

        t.eq( imageDiv.id, id, "image.id set correctly");    
        t.eq( imageDiv.style.left, xy.x + "px", "image.style.left set correctly");    
        t.eq( imageDiv.style.top, xy.y + "px", "image.style.top set correctly");    

        t.eq( imageDiv.style.width, sz.w + "px", "image.style.width set correctly");    
        t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");    

        t.eq( imageDiv.style.position, position, "image.style.positionset correctly");    
        t.eq( parseFloat(imageDiv.style.opacity), opacity, "element.style.opacity set correctly");    
        
        var filterString;
        if (OpenLayers.Util.alphaHack()) {
            filterString = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.openlayers.org/images/OpenLayers.trac.png', sizingMethod='crop') alpha(opacity=50)";
        } else {
            filterString = 'alpha(opacity=' + (opacity * 100) + ')';
        }        
        t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");


        image = imageDiv.firstChild;
        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
        t.eq( image.id, id + "_innerImage", "image.id set correctly");    

        t.eq( image.style.width, sz.w + "px", "image.style.width set correctly");    
        t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");    

        t.ok( (image.style.border.indexOf(border) != -1), "image.style.border set correctly");    
        t.eq( image.style.position, "relative", "image.style.positionset correctly");    

        if (OpenLayers.Util.alphaHack()) {
        
            t.eq(imageDiv.style.display, "inline-block", "imageDiv.style.display set correctly");

            var filter = "progid:DXImageTransform.Microsoft" +
                         ".AlphaImageLoader(src='" + img + "', " +
                         "sizingMethod='" + sizing + "') alpha(opacity=50)";
            t.eq(imageDiv.style.filter, filter, "div filter value correctly set");

            filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
            t.eq(image.style.filter, filter, "image filter set correctly");

        } else {
            t.eq( image.src, img, "image.style.backgroundImage correctly");    
            t.ok(true, "div filter value not set (not in IE)");
            t.ok(true, "image filter value not set (not in IE)");
        }

        var imageDiv = OpenLayers.Util.createAlphaImageDiv(id, xy, sz, img, position, border);
        if (OpenLayers.Util.alphaHack()) {
            var filter = "progid:DXImageTransform.Microsoft" +
                         ".AlphaImageLoader(src='" + img + "', " +
                         "sizingMethod='scale')";
            t.eq(imageDiv.style.filter, filter, "sizingMethod default correctly set to scale");
        } else {
            t.ok(true);
        }        

    }

    function test_09_Util_modifyDOMElement(t) {

        t.plan( 10 );

        var id = "boo";
        var px = new OpenLayers.Pixel(5,5);
        var sz = new OpenLayers.Size(10,10);
        var position = "absolute";
        var border = "1px solid";
        var overflow = "hidden";
        var opacity = 1/2;

        var element = document.createElement("div");

        OpenLayers.Util.modifyDOMElement(element, id, px, sz, position, 
                                         border, overflow, opacity);

        t.eq( element.id, id, "element.id set correctly");    
        t.eq( element.style.left, px.x + "px", "element.style.left set correctly");    
        t.eq( element.style.top, px.y + "px", "element.style.top set correctly");    

        t.eq( element.style.width, sz.w + "px", "element.style.width set correctly");    
        t.eq( element.style.height, sz.h + "px", "element.style.height set correctly");    

        t.eq( element.style.position, position, "element.style.position set correctly");    
        t.ok( (element.style.border.indexOf(border) != -1), "element.style.border set correctly");    
        t.eq( element.style.overflow, overflow, "element.style.overflow set correctly");    
        t.eq( parseFloat(element.style.opacity), opacity, "element.style.opacity set correctly");    
        var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
        t.eq( element.style.filter, filterString, "element.style.filter set correctly");
    }

    function test_09_Util_modifyAlphaImageDiv(t) {
        t.plan( 19 );

        var imageDiv = OpenLayers.Util.createAlphaImageDiv();

        var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
        var sz = new OpenLayers.Size(10,10);
        var xy = new OpenLayers.Pixel(5,5);
        var position = "absolute";
        var id = "boo";
        var border = "1px solid";
        var sizing = "crop";
        var opacity = 0.5;

        OpenLayers.Util.modifyAlphaImageDiv(imageDiv, id, xy, sz, img, position, border, sizing, opacity);
        if (OpenLayers.Util.alphaHack())
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( imageDiv.nodeName == "DIV", "createDiv creates a valid HTMLDivElement" );

        t.eq( imageDiv.id, id, "image.id set correctly");    
        t.eq( imageDiv.style.left, xy.x + "px", "image.style.left set correctly");    
        t.eq( imageDiv.style.top, xy.y + "px", "image.style.top set correctly");    

        t.eq( imageDiv.style.width, sz.w + "px", "image.style.width set correctly");    
        t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");    

        t.eq( imageDiv.style.position, position, "image.style.position set correctly");    
        t.eq( parseFloat(imageDiv.style.opacity), opacity, "element.style.opacity set correctly");    

        

        image = imageDiv.firstChild;

        var filterString;
        if (OpenLayers.Util.alphaHack()) {
            filterString = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.openlayers.org/images/OpenLayers.trac.png', sizingMethod='crop') alpha(opacity=50)";
            t.ok( true, "skipping element test outside of Mozilla");
        } else {
            var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
            t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
        }
        t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");
        t.eq( image.id, id + "_innerImage", "image.id set correctly");    

        t.eq( image.style.width, sz.w + "px", "image.style.width set correctly");    
        t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");    

        t.ok( (image.style.border.indexOf(border) != -1), "image.style.border set correctly");    
        t.eq( image.style.position, "relative", "image.style.positionset correctly");    

        if (OpenLayers.Util.alphaHack()) {
        
            t.eq(imageDiv.style.display, "inline-block", "imageDiv.style.display set correctly");

            var filter = "progid:DXImageTransform.Microsoft" +
                         ".AlphaImageLoader(src='" + img + "', " +
                         "sizingMethod='" + sizing + "') alpha(opacity=" + opacity *100 + ")";
            t.eq(imageDiv.style.filter, filter, "div filter value correctly set");

            filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
            t.eq(image.style.filter, filter, "image filter set correctly");

        } else {
            t.eq( image.src, img, "image.style.backgroundImage correctly");    
            t.ok(true, "div filter value not set (not in IE)");
            t.ok(true, "image filter value not set (not in IE)");
        }

        var imageDiv = OpenLayers.Util.createAlphaImageDiv(id, xy, sz, img, position, border, "scale", opacity);
        if (OpenLayers.Util.alphaHack()) {
            var filter = "progid:DXImageTransform.Microsoft" +
                         ".AlphaImageLoader(src='" + img + "', " +
                         "sizingMethod='scale') alpha(opacity=" + opacity *100 + ")";
            t.eq(imageDiv.style.filter, filter, "sizingMethod default correctly set to scale");
        } else {
            t.ok(true);
        }        
   
    }
       
    function test_10_Util_upperCaseObject(t) {
    
        t.plan(8);
        
        var aKey = "chicken";
        var aValue = "pot pie";

        var bKey = "blorg";
        var bValue = "us maximus";
        
        var obj = new Object();
        obj[aKey] = aValue;        
        obj[bKey] = bValue;        
             
        var uObj = OpenLayers.Util.upperCaseObject(obj);          

        //make sure old object not modified
        t.eq(obj[aKey], aValue, "old lowercase value still present in old obj");
        t.eq(obj[bKey], bValue, "old lowercase value still present in old obj");

        t.eq(obj[aKey.toUpperCase()], null, "new uppercase value not present in old obj");
        t.eq(obj[bKey.toUpperCase()], null, "new uppercase value not present in old obj");

        //make sure new object modified
        t.eq(uObj[aKey], null, "old lowercase value not present");
        t.eq(uObj[bKey], null, "old lowercase value not present");

        t.eq(uObj[aKey.toUpperCase()], aValue, "new uppercase value present");
        t.eq(uObj[bKey.toUpperCase()], bValue, "new uppercase value present");
    }
    
    function test_11_Util_createUniqueID(t) {
        t.plan(2);
        
        var id = OpenLayers.Util.createUniqueID();
        t.ok( id.startsWith("id_"), "default OpenLayers.Util.createUniqueID starts id correctly");

        var id = OpenLayers.Util.createUniqueID("chicken");
        t.ok( id.startsWith("chicken"), "OpenLayers.Util.createUniqueID starts id correctly");
    }
    
    function test_12_Util_limitSigDigs(t) {

        t.plan(7);

        var x;

        x = 123456;
        t.eq(x.limitSigDigs(3), 123000, "correctly rounds down");

        x = 555555;
        t.eq(x.limitSigDigs(3), 556000, "correctly rounds up");

        x = 66;
        t.eq(x.limitSigDigs(3), 66, "correctly handles number smaller than sigdig");

        t.eq(x.limitSigDigs(null), 0, "correctly handles null sigdig");
        t.eq(x.limitSigDigs(0), 0, "correctly handles 0 sigdig");
        t.eq(x.limitSigDigs(-1), 0, "correctly handles negative sigdig");

        x = 0;
        t.eq(x.limitSigDigs(2), 0, "correctly handles 0 number");



    }
    
    function test_13_Util_normalizeScale(t) {
        t.plan(2); 
        
        //normal scale
        var scale = 1/5;
        t.eq( OpenLayers.Util.normalizeScale(scale), scale, "normalizing a normal scale does nothing");

        //funky scale
        var scale = 5;
        t.eq( OpenLayers.Util.normalizeScale(scale), 1/5, "normalizing a wrong scale works!");


    }
    
    function test_13_Util_getScaleResolutionTranslation(t) {
        t.plan(4); 
        
        var scale = 1/150000000; 
        var resolution = OpenLayers.Util.getResolutionFromScale(scale);
        t.eq(resolution.toFixed(6), "0.476217", "Calculated correct resolution for " + scale);

        var scale = 1/150000000; 
        var resolution = OpenLayers.Util.getResolutionFromScale(scale, 'm');
        t.eq(resolution.toFixed(6), "52916.638092", "Calculated correct resolution for " + scale);

        scale = 150000000; 
        resolution = OpenLayers.Util.getResolutionFromScale(scale);
        t.eq(resolution.toFixed(6), "0.476217", "Calculated correct resolution for " + scale);

        scale = 150000000; 
        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 ''."); 
    }

    function test_15_Util_isEquivalentUrl(t) {
        t.plan(8);
        
        var url1, url2, options;

  //CASE

        url1 = "http://www.openlayers.org";
        url2 = "HTTP://WWW.OPENLAYERS.ORG";

        t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignoreCase works"); 

  //ARGS

        url1 = "http://www.openlayers.org?foo=5;bar=6";
        url2 = "http://www.openlayers.org?bar=6;foo=5";

        t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "shuffled arguments works"); 

  //PORT

        url1 = "http://www.openlayers.org:80";
        url2 = "http://www.openlayers.org";

        t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignorePort80 works"); 

        options = {
            'ignorePort80': false
        }        
        url1 = "http://www.openlayers.org:80";
        url2 = "http://www.openlayers.org:50";

        t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2, options), "port check works"); 


  //HASH

        url1 = "http://www.openlayers.org#barf";
        url2 = "http://www.openlayers.org";

        t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignoreHash works"); 
        options = {
            'ignoreHash': false
        }        
        t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2, options), "ignoreHash FALSE works"); 

  //PROTOCOL

        url1 = "http://www.openlayers.org";
        url2 = "ftp://www.openlayers.org";

        t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignoreHash works"); 


  //PATHNAME
        url1 = "foo.html?bar=now#go";
        url2 = "../tests/../tests/foo.html?bar=now#go";

        t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "relative vs. absolute paths works"); 
        
 
    }
    function test_Util_createUniqueIDSeq(t) {
        t.plan(1);
        OpenLayers.Util.lastSeqID = 0;
        OpenLayers.Util.createDiv();
        OpenLayers.Util.createDiv();
        t.eq(OpenLayers.Util.createDiv().id, "OpenLayersDiv3", "Div created is sequential, starting at lastSeqID in Util.");
    }
   // -->
  </script>
</head>
<body>
    <div id="map" style="width: 1024px; height: 512px;"/>
</body>
</html>