Have various compares to output the compared values if they are not equal.

This commit is contained in:
Jürg Lehni 2011-05-26 10:55:39 +01:00
parent 088f1f88af
commit 4029e6abf7

View file

@ -146,16 +146,14 @@ function comparePathStyles(style, style2, checkIdentity) {
} }
} }
function compareObjects(name, keys, obj1, obj2, checkIdentity) { function compareObjects(name, keys, obj, obj2, checkIdentity) {
if (checkIdentity) { if (checkIdentity) {
equals(function() { equals(function() {
return obj1 != obj2; return obj != obj2;
}, true); }, true);
} }
Base.each(keys, function(key) { Base.each(keys, function(key) {
equals(function() { equals(obj[key], obj2[key], 'Compare ' + name + '#' + key);
return obj1[key] == obj2[key];
}, true, 'Compare ' + name + '#' + key);
}); });
} }
@ -223,9 +221,7 @@ function compareItems(item, item2, checkIdentity) {
var itemProperties = ['opacity', 'locked', 'visible', 'blendMode', 'name', var itemProperties = ['opacity', 'locked', 'visible', 'blendMode', 'name',
'selected', 'clipMask']; 'selected', 'clipMask'];
Base.each(itemProperties, function(key) { Base.each(itemProperties, function(key) {
equals(function() { equals(item[key], item2[key], 'compare Item#' + key);
return item[key] == item2[key];
}, true, 'compare Item#' + key);
}); });
if (checkIdentity) { if (checkIdentity) {
@ -261,9 +257,7 @@ function compareItems(item, item2, checkIdentity) {
var keys = ['closed', 'fullySelected', 'clockwise', 'length']; var keys = ['closed', 'fullySelected', 'clockwise', 'length'];
for (var i = 0, l = keys.length; i < l; i++) { for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i]; var key = keys[i];
equals(function() { equals(item[key], item2[key], 'Compare Path#' + key);
return item[key] == item2[key];
}, true, 'Compare Path#' + key);
} }
compareSegmentLists(item.segments, item2.segments, checkIdentity); compareSegmentLists(item.segments, item2.segments, checkIdentity);
} }