Skip to content

Commit

Permalink
-test tweak
Browse files Browse the repository at this point in the history
- fix compressed pngs not working
  • Loading branch information
GoodBoyDigital committed Apr 19, 2024
1 parent 8aca520 commit ce1e477
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/mipmap-compress/src/utils/compressSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export async function compressSharp(
{
// optimising the PNG image and using that as the source of the WebP and AVIF images
// will result in a smaller file size and increase the speed of the compression.
sharpImage = sharp(await image.sharpImage.png(options.png as PngOptions).toBuffer());
sharpImage = sharp(await image.sharpImage.png({ ...options.png as PngOptions, force: true }).toBuffer());

compressed.push({
format: '.png',
resolution: image.resolution,
sharpImage
sharpImage: sharpImage.clone(),
});
}

Expand Down
6 changes: 4 additions & 2 deletions packages/texture-packer/test/texturePacker.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AssetPack } from '@play-co/assetpack-core';
import { AssetPack, Logger } from '@play-co/assetpack-core';
import { existsSync, readJSONSync } from 'fs-extra';
import sharp from 'sharp';
import type { File } from '../../../shared/test/index';
Expand Down Expand Up @@ -70,6 +70,8 @@ describe('Texture Packer', () =>
const sheet2Exists = existsSync(`${outputDir}/sprites-1.json`);

expect(sheet2Exists).toBe(false);

expect(existsSync(`${outputDir}/sprites`)).toBe(false);
});

it('should adjust the size of the textures outputted based on maximumTextureSize', async () =>
Expand Down Expand Up @@ -567,7 +569,7 @@ describe('Texture Packer', () =>
});

// Mock console.warn
const mockWarn = jest.spyOn(console, 'warn').mockImplementation();
const mockWarn = jest.spyOn(Logger, 'warn').mockImplementation();

await assetpack.run();

Expand Down

0 comments on commit ce1e477

Please sign in to comment.