(actual, expected, message, options, properties)
| 307 | }; |
| 308 | |
| 309 | var compareItem = function(actual, expected, message, options, properties) { |
| 310 | options = options || {}; |
| 311 | if (options.rasterize) { |
| 312 | comparePixels(actual, expected, message, options); |
| 313 | } else if (!actual || !expected) { |
| 314 | QUnit.strictEqual(actual, expected, message); |
| 315 | } else { |
| 316 | if (options.cloned) |
| 317 | QUnit.notStrictEqual(actual.id, expected.id, |
| 318 | message + ' (not #id)'); |
| 319 | QUnit.strictEqual(actual.constructor, expected.constructor, |
| 320 | message + ' (#constructor)'); |
| 321 | // When item is cloned and has a name, the name will be versioned: |
| 322 | equals(actual.name, |
| 323 | options.cloned && expected.name |
| 324 | ? expected.name + ' 1' : expected.name, |
| 325 | message + ' (#name)'); |
| 326 | compareProperties(actual, expected, ['children', 'bounds', 'position', |
| 327 | 'matrix', 'data', 'opacity', 'locked', 'visible', 'blendMode', |
| 328 | 'selected', 'fullySelected', 'clipMask', 'guide'], |
| 329 | message, options); |
| 330 | if (properties) |
| 331 | compareProperties(actual, expected, properties, message, options); |
| 332 | // Style |
| 333 | var styles = ['fillColor', |
| 334 | 'strokeColor', 'strokeCap', 'strokeJoin', 'dashArray', |
| 335 | 'dashOffset', 'miterLimit']; |
| 336 | if (expected instanceof TextItem) |
| 337 | styles.push('fontSize', 'font', 'leading', 'justification'); |
| 338 | compareProperties(actual.style, expected.style, styles, |
| 339 | message + ' (#style)', options); |
| 340 | } |
| 341 | }; |
| 342 | |
| 343 | // A list of comparator functions, based on `expected` type. See equals() for |
| 344 | // an explanation of how the type is determined. |
no test coverage detected