modify all equals() functions in Util.js (Size, Pixel, LonLat, Bounds) such that if a null value is passed in, they return false. Tests updated to make sure this is true.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@608 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-06-17 14:12:56 +00:00
parent 988cf47bdd
commit 86b99df3f3
5 changed files with 40 additions and 9 deletions
+2 -1
View File
@@ -171,13 +171,14 @@
}
function test_11_Bounds_equals(t) {
t.plan( 2 );
t.plan( 3 );
var boundsA = new OpenLayers.Bounds(1,2,3,4);
var boundsB = new OpenLayers.Bounds(1,2,3,4);
var boundsC = new OpenLayers.Bounds(1,5,3,4);
t.ok( boundsA.equals(boundsB), "equals() returns true on two equal bounds." );
t.ok( !boundsA.equals(boundsC), "equals() returns false on two different bounds." );
t.ok( !boundsA.equals(null), "equals() returns false on comparison to null");
}
function test_12_Bounds_getHeight_getWidth(t) {
+4 -1
View File
@@ -52,7 +52,7 @@
}
function test_06_LonLat_equals(t) {
t.plan( 4 );
t.plan( 5 );
lonlat = new OpenLayers.LonLat(5,6);
ll = new OpenLayers.LonLat(5,6);
@@ -66,6 +66,9 @@
ll = new OpenLayers.LonLat(1,2);
t.eq( lonlat.equals(ll), false, "(5,6) does not equal (1,2)");
t.ok( !lonlat.equals(null), "equals() returns false on comparison to null");
}
function test_07_LonLat_fromString(t) {
+4 -1
View File
@@ -32,7 +32,7 @@
}
function test_06_Pixel_equals(t) {
t.plan( 4 );
t.plan( 5 );
pixel = new OpenLayers.Pixel(5,6);
px = new OpenLayers.Pixel(5,6);
@@ -46,6 +46,9 @@
px = new OpenLayers.Pixel(1,2);
t.eq( pixel.equals(px), false, "(5,6) does not equal (1,2)");
t.ok( !pixel.equals(null), "equals() returns false on comparison to null");
}
function test_07_Pixel_add(t) {
+3 -1
View File
@@ -33,7 +33,7 @@
}
function test_04_Size_equals(t) {
t.plan( 4 );
t.plan( 5 );
size = new OpenLayers.Size(5,6);
sz = new OpenLayers.Size(5,6);
@@ -47,6 +47,8 @@
sz = new OpenLayers.Size(1,2);
t.eq( size.equals(sz), false, "(5,6) does not equal (1,2)");
t.ok( !size.equals(null), "equals() returns false on comparison to null");
}
// -->