Skip to content

Commit

Permalink
Add internal converter to Sharpen action (#50)
Browse files Browse the repository at this point in the history
* Add internal converter to Sharpen action

* Enforce CI run

* Force CI update
  • Loading branch information
magdakwiecien authored Mar 19, 2024
1 parent cecf5e4 commit f4f7e91
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions __TESTS__/unit/fromJson/adjust.fromJson.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ describe('adjust.fromJson', () => {
const transformation = fromJson({actions:[
{ actionType: 'improve', mode: 'outdoor', blend: 30},
{ actionType: 'unsharpMask', strength: 50},
{ actionType: 'sharpen', strength: 50},
{ actionType: 'saturation', level: 40},
{actionType: 'contrast', level: 40},
{actionType: 'brightness', level: 30},
Expand All @@ -15,6 +16,7 @@ describe('adjust.fromJson', () => {
expect(transformation.toString()).toStrictEqual([
'e_improve:outdoor:30',
'e_unsharp_mask:50',
'e_sharpen:50',
'e_saturation:40',
'e_contrast:40',
'e_brightness:30',
Expand Down
11 changes: 11 additions & 0 deletions __TESTS__/unit/toJson/adjust.toJson.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,15 @@ describe('Adjust toJson()', () => {
}
]});
});

it('adjust.sharpen', () => {
const transformation = new Transformation()
.addAction(Adjust.sharpen(45));
expect(transformation.toJson()).toStrictEqual({actions:[
{
actionType: 'sharpen',
level: 45
}
]});
});
});
3 changes: 2 additions & 1 deletion src/internal/fromJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ const ActionModelMap: Record<string, IHasFromJson> = {
auto: ResizeAdvancedAction,
backgroundColor: BackgroundColor,
autoPad: ResizeAutoPadAction,
enhance: SimpleEffectAction
enhance: SimpleEffectAction,
sharpen: EffectActionWithStrength
};

/**
Expand Down

0 comments on commit f4f7e91

Please sign in to comment.