Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(Pixelate) add a test for the fixed filter #10083

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [next]

- fix(filter): pixelate filter has non square pixels in webgl (#10081)
- feat(Canvas): Avoid styling the lower canvas with absolute positioning [#10077](https://github.com/fabricjs/fabric.js/pull/10077)
- chore(TS): Add missing export type for Text events [#10076](https://github.com/fabricjs/fabric.js/pull/10076)
- chore(CI): Move test actions to Node 20 [#10073](https://github.com/fabricjs/fabric.js/pull/10073)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions e2e/tests/visual-output/rendering/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ beforeRenderTest(
return {
boundFunction: async () => {
canvas.clear();
canvas.setZoom(1);
canvas.setDimensions({
width: renderTest.size[0],
height: renderTest.size[1],
Expand Down
28 changes: 28 additions & 0 deletions e2e/tests/visual-output/rendering/renderingCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,34 @@ export const renderTests: renderTestType[] = [
canvas.setZoom(0.4);
},
},
{
size: [450, 220],
percentage: 0.01,
title: 'pixelate filter',
golden: 'pixelate-filter.png',
renderFunction: async function render(
canvas: Canvas,
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
fabric: typeof import('fabric'),
) {
const imgSource = fabric.getFabricDocument().createElement('canvas');
imgSource.width = 450;
imgSource.height = 220;
const ctx = imgSource.getContext('2d');
const gradient = ctx.createLinearGradient(0, 0, 450, 220);
gradient.addColorStop(0, 'yellow');
gradient.addColorStop(0.5, 'black');
gradient.addColorStop(1, 'cyan');
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, imgSource.width, imgSource.height);
const img = new fabric.FabricImage(imgSource);
canvas.add(img);
img.filters[0] = new fabric.filters.Pixelate({
blocksize: 20,
});
img.applyFilters();
},
},
];

// function polygonWithStroke(canvas, callback) {
Expand Down
Loading