-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added transformColorSpace to MagickImage (#190).
- Loading branch information
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
Copyright Dirk Lemstra https://github.com/dlemstra/magick-wasm. | ||
Licensed under the Apache License, Version 2.0. | ||
*/ | ||
|
||
import { TestFiles } from '@test/test-files'; | ||
|
||
describe('MagickImage#transformColorSpace', () => { | ||
it('should return false when the image has no color profile', () => { | ||
TestFiles.Images.Builtin.logo.use((image) => { | ||
const target = TestFiles.Profiles.Color.sRGB.load(); | ||
const result = image.transformColorSpace(target); | ||
expect(result).toBe(false); | ||
}); | ||
}); | ||
|
||
it('should use the color profile of the image', () => { | ||
TestFiles.Images.fujiFilmFinePixS1ProJpg.use((image) => { | ||
const target = TestFiles.Profiles.Color.USWebCoatedSWOP.load(); | ||
const result = image.transformColorSpace(target); | ||
expect(result).toBe(true); | ||
}); | ||
}); | ||
|
||
it('should return false when the source profile color space is different', () => { | ||
TestFiles.Images.fujiFilmFinePixS1ProJpg.use((image) => { | ||
const source = TestFiles.Profiles.Color.USWebCoatedSWOP.load(); | ||
const target = TestFiles.Profiles.Color.sRGB.load(); | ||
const result = image.transformColorSpace(source, target); | ||
expect(result).toBe(false); | ||
}); | ||
}); | ||
|
||
it('should return true when the the colorspace could be transformed', () => { | ||
TestFiles.Images.fujiFilmFinePixS1ProJpg.use((image) => { | ||
const source = TestFiles.Profiles.Color.sRGB.load(); | ||
const target = TestFiles.Profiles.Color.USWebCoatedSWOP.load(); | ||
const result = image.transformColorSpace(source, target); | ||
expect(result).toBe(true); | ||
}); | ||
}); | ||
}); |