diff --git a/tests/magick-image-collection/optimize-plus.spec.ts b/tests/magick-image-collection/optimize-plus.spec.ts index 7dfd49a..3ca8d1a 100644 --- a/tests/magick-image-collection/optimize-plus.spec.ts +++ b/tests/magick-image-collection/optimize-plus.spec.ts @@ -28,30 +28,21 @@ describe('MagickImageCollection#optimizePlus', () => { }); it('should add additional images', () => { - TestImages.emptyCollection.use((images) => { + TestImages.movingHoleGif.use((images) => { - images.push(MagickImage.create(MagickColors.Red, 1, 2)); - images.push(MagickImage.create(MagickColors.Red, 1, 2)); - - const second = MagickImage.create(MagickColors.Red, 1, 1); - second.extent(1, 2, MagickColors.Green); - images.push(second); + expect(images.length).toBe(4); images.optimizePlus(); - expect(images.length).toBe(3); - expect(images[0].width).toBe(1); - expect(images[0].height).toBe(2); - - expect(images[1].width).toBe(1); - expect(images[1].height).toBe(1); - expect(images[1].page.x).toBe(-1); - expect(images[1].page.y).toBe(-1); + expect(images.length).toBe(7); - expect(images[2].width).toBe(1); - expect(images[2].height).toBe(1); - expect(images[2].page.x).toBe(0); - expect(images[2].page.y).toBe(1); + expect(images[0].page.toString()).toBe('100x100+0+0'); + expect(images[1].page.toString()).toBe('100x100+61+27'); + expect(images[2].page.toString()).toBe('100x100+27+12'); + expect(images[3].page.toString()).toBe('100x100+46+61'); + expect(images[4].page.toString()).toBe('100x100+46+27'); + expect(images[5].page.toString()).toBe('100x100+12+46'); + expect(images[6].page.toString()).toBe('100x100+12+46'); }); }); }); diff --git a/tests/magick-image-collection/optimize.spec.ts b/tests/magick-image-collection/optimize.spec.ts index 610df13..75f4a96 100644 --- a/tests/magick-image-collection/optimize.spec.ts +++ b/tests/magick-image-collection/optimize.spec.ts @@ -28,21 +28,30 @@ describe('MagickImageCollection#evaluate', () => { }); it('should optimize the images', () => { - TestImages.movingHoleGif.use((images) => { + TestImages.emptyCollection.use((images) => { + + images.push(MagickImage.create(MagickColors.Red, 1, 2)); + images.push(MagickImage.create(MagickColors.Red, 1, 2)); + + const image = MagickImage.create(MagickColors.Red, 1, 1); + image.extent(1, 2, MagickColors.Green); + images.push(image); - expect(images.length).toBe(4); + images.optimize(); - images.optimizePlus(); + expect(images.length).toBe(3); + expect(images[0].width).toBe(1); + expect(images[0].height).toBe(2); - expect(images.length).toBe(7); + expect(images[1].width).toBe(1); + expect(images[1].height).toBe(1); + expect(images[1].page.x).toBe(-1); + expect(images[1].page.y).toBe(-1); - expect(images[0].page.toString()).toBe('100x100+0+0'); - expect(images[1].page.toString()).toBe('100x100+61+27'); - expect(images[2].page.toString()).toBe('100x100+27+12'); - expect(images[3].page.toString()).toBe('100x100+46+61'); - expect(images[4].page.toString()).toBe('100x100+46+27'); - expect(images[5].page.toString()).toBe('100x100+12+46'); - expect(images[6].page.toString()).toBe('100x100+12+46'); + expect(images[2].width).toBe(1); + expect(images[2].height).toBe(1); + expect(images[2].page.x).toBe(0); + expect(images[2].page.y).toBe(1); }); }); });