All geometry equals methods now work with bad arguments (closes #1041).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@4707 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -288,7 +288,8 @@ OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {
|
|||||||
*/
|
*/
|
||||||
equals: function(geometry) {
|
equals: function(geometry) {
|
||||||
var equivalent = true;
|
var equivalent = true;
|
||||||
if(!geometry.CLASS_NAME || (this.CLASS_NAME != geometry.CLASS_NAME)) {
|
if(!geometry || !geometry.CLASS_NAME ||
|
||||||
|
(this.CLASS_NAME != geometry.CLASS_NAME)) {
|
||||||
equivalent = false;
|
equivalent = false;
|
||||||
} else if(!(geometry.components instanceof Array) ||
|
} else if(!(geometry.components instanceof Array) ||
|
||||||
(geometry.components.length != this.components.length)) {
|
(geometry.components.length != this.components.length)) {
|
||||||
|
|||||||
@@ -132,6 +132,12 @@
|
|||||||
t.eq(coll.bounds.top, 70, "good top bounds");
|
t.eq(coll.bounds.top, 70, "good top bounds");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_Collection_equals(t) {
|
||||||
|
t.plan(1);
|
||||||
|
var geom = new OpenLayers.Geometry.Collection();
|
||||||
|
t.ok(!geom.equals(), "collection.equals() returns false for undefined");
|
||||||
|
}
|
||||||
|
|
||||||
function test_07_Collection_addComponent(t) {
|
function test_07_Collection_addComponent(t) {
|
||||||
t.plan(10);
|
t.plan(10);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user