(mode, mask)
| 2507 | suite('clip()', function() { |
| 2508 | //let myp5; |
| 2509 | function getClippedPixels(mode, mask) { |
| 2510 | // Clean up the last myp5 instance, since this may be called more than |
| 2511 | // once per test |
| 2512 | myp5.remove(); |
| 2513 | myp5 = new p5(function(p) { |
| 2514 | p.setup = function() {}; |
| 2515 | p.draw = function() {}; |
| 2516 | }); |
| 2517 | |
| 2518 | myp5.createCanvas(50, 50, mode); |
| 2519 | myp5.pixelDensity(1); |
| 2520 | if (mode === myp5.WEBGL) { |
| 2521 | myp5.translate(-myp5.width / 2, -myp5.height / 2); |
| 2522 | } |
| 2523 | mask(); |
| 2524 | myp5.loadPixels(); |
| 2525 | return [...myp5.pixels]; |
| 2526 | } |
| 2527 | |
| 2528 | function getPixel(pixels, x, y) { |
| 2529 | const start = (y * myp5.width + x) * 4; |
no test coverage detected