(mode, initialize, filterType)
| 628 | ]; |
| 629 | |
| 630 | const getFilteredPixels = (mode, initialize, filterType) => { |
| 631 | myp5.createCanvas(10, 10, mode === 'p2d' ? myp5.P2D : myp5.WEBGL); |
| 632 | myp5.pixelDensity(1); |
| 633 | myp5.background(255); |
| 634 | if (mode === 'webgl') { |
| 635 | myp5.translate(-5, -5); |
| 636 | } |
| 637 | myp5.noStroke(); |
| 638 | myp5.fill(255, 0, 0); |
| 639 | myp5.rectMode(myp5.CORNER); |
| 640 | myp5.rect(3, 3, 4, 4); |
| 641 | initialize(); |
| 642 | myp5.filter(filterType); |
| 643 | myp5.loadPixels(); |
| 644 | const pixels = [...myp5.pixels]; |
| 645 | myp5.remove(); |
| 646 | return pixels; |
| 647 | }; |
| 648 | |
| 649 | for (const filterType of ['blur', 'invert']) { |
| 650 | suite(`${filterType} filter`, function() { |
no test coverage detected