MCPcopy
hub / github.com/paperjs/paper.js / compareBoolean

Function compareBoolean

test/helpers.js:523–560  ·  view source on GitHub ↗
(actual, expected, message, options)

Source from the content-addressed store, hash-verified

521};
522
523var compareBoolean = function(actual, expected, message, options) {
524 expected = typeof expected === 'string'
525 ? PathItem.create(expected)
526 : expected;
527 if (typeof actual === 'function') {
528 if (!message)
529 message = getFunctionMessage(actual);
530 actual = actual();
531 }
532 var parent,
533 index,
534 style = {
535 strokeColor: 'black',
536 fillColor: expected && (expected.closed
537 || expected.firstChild && expected.firstChild.closed && 'yellow')
538 || null
539 };
540 if (actual) {
541 parent = actual.parent;
542 index = actual.index;
543 // Remove it from parent already now, in case we're comparing children
544 // of compound-paths, so we can apply styling to them.
545 if (parent && parent instanceof CompoundPath) {
546 actual.remove();
547 } else {
548 parent = null;
549 }
550 actual.style = style;
551 }
552 if (expected) {
553 expected.style = style;
554 }
555 equals(actual, expected, message, Base.set({ rasterize: true }, options));
556 if (parent) {
557 // Insert it back.
558 parent.insertChild(index, actual);
559 }
560};
561
562var createSVG = function(str, attrs) {
563 // Similar to SvgElement.create():

Callers 3

testOperationsFunction · 0.85
Path_Boolean.jsFile · 0.85
executeTestFunction · 0.85

Calls 2

getFunctionMessageFunction · 0.85
equalsFunction · 0.85

Tested by

no test coverage detected