|
1 | 1 | import {Transformation} from "../../../src"; |
2 | 2 | import {Effect} from "../../../src/actions/effect"; |
3 | 3 | import {halftone4x4Orthogonal} from "../../../src/qualifiers/dither"; |
| 4 | +import {rodMonochromacy} from "../../../src/qualifiers/simulateColorBlind"; |
| 5 | +import {Region} from "../../../src/qualifiers"; |
4 | 6 |
|
5 | 7 |
|
6 | 8 | describe('Effect toJson()', () => { |
@@ -206,4 +208,88 @@ describe('Effect toJson()', () => { |
206 | 208 | } |
207 | 209 | ]); |
208 | 210 | }); |
| 211 | + |
| 212 | + it('effect.vectorize', () => { |
| 213 | + const transformation = new Transformation() |
| 214 | + .addAction(Effect.vectorize().numOfColors(17).detailsLevel(100)); |
| 215 | + expect(transformation.toJson()).toStrictEqual( [ |
| 216 | + { |
| 217 | + actionType: 'vectorize', |
| 218 | + numOfColors: 17, |
| 219 | + detailLevel: 100 |
| 220 | + } |
| 221 | + ]); |
| 222 | + }); |
| 223 | + |
| 224 | + it('effect.gradientFade', () => { |
| 225 | + const transformation = new Transformation() |
| 226 | + .addAction(Effect.gradientFade() |
| 227 | + .strength(5) |
| 228 | + .horizontalStartPoint(10) |
| 229 | + .verticalStartPoint(20)); |
| 230 | + expect(transformation.toJson()).toStrictEqual( [ |
| 231 | + { |
| 232 | + actionType: 'GradientFade', |
| 233 | + strength: 5, |
| 234 | + horizontalStartPoint: 10, |
| 235 | + verticalStartPoint: 20 |
| 236 | + } |
| 237 | + ]); |
| 238 | + }); |
| 239 | + |
| 240 | + it('effect.assistColorBlind', () => { |
| 241 | + const transformation = new Transformation() |
| 242 | + .addAction(Effect.assistColorBlind().stripesStrength(20)); |
| 243 | + expect(transformation.toJson()).toStrictEqual( [ |
| 244 | + { |
| 245 | + actionType: 'assistColorblind', |
| 246 | + type: 'stripes', |
| 247 | + stripesStrength: 20 |
| 248 | + } |
| 249 | + ]); |
| 250 | + }); |
| 251 | + |
| 252 | + it('effect.simulateColorBlind', () => { |
| 253 | + const transformation = new Transformation() |
| 254 | + .addAction(Effect.simulateColorBlind().condition(rodMonochromacy())); |
| 255 | + expect(transformation.toJson()).toStrictEqual( [ |
| 256 | + { actionType: 'simulateColorblind', |
| 257 | + condition: 'rod_monochromacy' |
| 258 | + } |
| 259 | + ]); |
| 260 | + }); |
| 261 | + |
| 262 | + it('effect.deshake', () => { |
| 263 | + const transformation = new Transformation() |
| 264 | + .addAction(Effect.deshake().shakeStrength(16)); |
| 265 | + expect(transformation.toJson()).toStrictEqual( [ |
| 266 | + { |
| 267 | + actionType: 'deshake', |
| 268 | + pixels: 16 |
| 269 | + } |
| 270 | + ]); |
| 271 | + }); |
| 272 | + |
| 273 | + it('effect.pixelate', () => { |
| 274 | + const transformation = new Transformation() |
| 275 | + .addAction(Effect.pixelate().squareSize(15).region(Region.faces())); |
| 276 | + expect(transformation.toJson()).toStrictEqual( [ |
| 277 | + { |
| 278 | + actionType: 'pixelate', |
| 279 | + squareSize: 15, |
| 280 | + region: { RegionType: 'faces' } |
| 281 | + } |
| 282 | + ]); |
| 283 | + }); |
| 284 | + |
| 285 | + it('effect.blur', () => { |
| 286 | + const transformation = new Transformation() |
| 287 | + .addAction(Effect.blur().strength(5)); |
| 288 | + expect(transformation.toJson()).toStrictEqual( [ |
| 289 | + { |
| 290 | + actionType: 'blur', |
| 291 | + strength: 5, |
| 292 | + } |
| 293 | + ]); |
| 294 | + }); |
209 | 295 | }); |
0 commit comments