-
-
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.
Moved setting of the artifacts to settings.
- Loading branch information
Showing
5 changed files
with
89 additions
and
14 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
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,33 @@ | ||
/* | ||
Copyright Dirk Lemstra https://github.com/dlemstra/magick-wasm. | ||
Licensed under the Apache License, Version 2.0. | ||
*/ | ||
|
||
import { ErrorMetric } from '@src/enums/error-metric'; | ||
import { TemporaryDefines } from '@src/helpers/temporary-defines'; | ||
import { MagickColors } from '@src/magick-colors'; | ||
import { CompareSettings } from '@src/settings/compare-settings'; | ||
import { TestImages } from '@test/test-images'; | ||
|
||
describe('CompareSettings', () => { | ||
const settings = new CompareSettings(ErrorMetric.NormalizedCrossCorrelation); | ||
settings.highlightColor = MagickColors.Honeydew; | ||
settings.lowlightColor = MagickColors.LemonChiffon; | ||
settings.masklightColor = MagickColors.Moccasin; | ||
|
||
describe('#_setArtifacts', () => { | ||
it('should add all defined artifacts to the provided image', () => { | ||
TestImages.Builtin.logo.use((image) => { | ||
TemporaryDefines.use(image, (temporaryDefines) => { | ||
settings._setArtifacts(temporaryDefines); | ||
|
||
expect(settings.metric).toBe(ErrorMetric.NormalizedCrossCorrelation); | ||
expect(image.artifactNames.length).toBe(3); | ||
expect(image.getArtifact('compare:highlight-color')).toBe('#f0fff0ff'); | ||
expect(image.getArtifact('compare:lowlight-color')).toBe('#fffacdff'); | ||
expect(image.getArtifact('compare:masklight-color')).toBe('#ffe4b5ff'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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,31 @@ | ||
/* | ||
Copyright Dirk Lemstra https://github.com/dlemstra/magick-wasm. | ||
Licensed under the Apache License, Version 2.0. | ||
*/ | ||
|
||
import { DistortMethod } from '@src/enums/distort-method'; | ||
import { TemporaryDefines } from '@src/helpers/temporary-defines'; | ||
import { DistortSettings } from '@src/settings/distort-settings'; | ||
import { MagickGeometry } from '@src/types/magick-geometry'; | ||
import { TestImages } from '@test/test-images'; | ||
|
||
describe('DistortSettings', () => { | ||
const settings = new DistortSettings(DistortMethod.Perspective); | ||
settings.scale = 42; | ||
settings.viewport = new MagickGeometry(1, 2, 3, 4); | ||
|
||
describe('#_setArtifacts', () => { | ||
it('should add all defined artifacts to the provided image', () => { | ||
TestImages.Builtin.logo.use((image) => { | ||
TemporaryDefines.use(image, (temporaryDefines) => { | ||
settings._setArtifacts(temporaryDefines); | ||
|
||
expect(settings.method).toBe(DistortMethod.Perspective); | ||
expect(image.artifactNames.length).toBe(2); | ||
expect(image.getArtifact('distort:scale')).toBe('42'); | ||
expect(image.getArtifact('distort:viewport')).toBe('3x4+1+2'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |