Skip to content

Commit

Permalink
fix: pass datasets using fn arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafaznv committed Dec 15, 2024
1 parent d1a0893 commit c1e588a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
26 changes: 13 additions & 13 deletions tests/Unit/FFMpegTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,49 +94,49 @@
@unlink($path);

})->with([
[
fn() => [
'fromSeconds' => 0,
'style' => ImageStyle::make('cover', 400, 300, LaruploadMediaStyle::FIT),
'width' => 400,
'height' => 300,
'hash' => ['ff1190d19a78893233945f6c1ff405ff', 'b0900d5ec361495f121fe122f6867512', '6155e85de3c83288426ca98c30f90d35']
],
[
fn() => [
'fromSeconds' => 1,
'style' => ImageStyle::make('cover', 400, 300, LaruploadMediaStyle::AUTO),
'width' => 400,
'height' => 226,
'hash' => ['7ebea4afbe53f5d52c61973fa94d218a', '2c58b919940e3e9ef551ff10bff3273e', '12fc748b3226079d35d01046dfafceeb']
],
[
fn() => [
'fromSeconds' => 2,
'style' => ImageStyle::make('cover', null, 300, LaruploadMediaStyle::SCALE_WIDTH),
'width' => 534,
'height' => 300,
'hash' => ['a70cd56c065ec6c02fc60dbffcc0326a', '66444a2e3642994f9c67701ca0ec65d2', 'db4160a73d254c10b0a1b32c802a29ec']
],
[
fn() => [
'fromSeconds' => 3,
'style' => ImageStyle::make('cover', 400, null, LaruploadMediaStyle::SCALE_HEIGHT),
'width' => 400,
'height' => 226,
'hash' => ['41f01b4fad7e8212b7563421c3ef7db6', '294363c52d24c6ecf09550d21bf05528', '42590265e173739b54fc6c5b8cb32221']
],
[
fn() => [
'fromSeconds' => 4,
'style' => ImageStyle::make('cover', 400, 300, LaruploadMediaStyle::CROP),
'width' => 400,
'height' => 300,
'hash' => ['a298452b17b6f725655dec733e2caa0c', 'd25d8dae46a853bb291b8c223a1a5165', '6829213239d6d0d2f180ce02c4bef717']
],
[
fn() => [
'fromSeconds' => 5,
'style' => ImageStyle::make('cover', 400, 300, LaruploadMediaStyle::CROP),
'width' => 400,
'height' => 300,
'hash' => ['136d39b3469cc80223d0214e6382d155', '57e84a29f42f080d6bc1c97369d1ea0a', '7288c027bbb98e05ed004bd1dbfbb8d8']
],
[
fn() => [
'fromSeconds' => null, // center
'style' => ImageStyle::make('cover', 400, 300, LaruploadMediaStyle::CROP),
'width' => 400,
Expand Down Expand Up @@ -235,32 +235,32 @@
@unlink($path);

})->with([
[
fn() => [
'style' => VideoStyle::make('fit', 400, 300, LaruploadMediaStyle::FIT),
'width' => 400,
'height' => 300,
],
[
fn() => [
'style' => VideoStyle::make('auto', 400, 300, LaruploadMediaStyle::AUTO),
'width' => 400,
'height' => 226,
],
[
fn() => [
'style' => VideoStyle::make('scale-width', null, 300, LaruploadMediaStyle::SCALE_WIDTH),
'width' => 534,
'height' => 300,
],
[
fn() => [
'style' => VideoStyle::make('scale-height', 400, null, LaruploadMediaStyle::SCALE_HEIGHT),
'width' => 400,
'height' => 226,
],
[
fn() => [
'style' => VideoStyle::make('crop', 400, 300, LaruploadMediaStyle::CROP),
'width' => 400,
'height' => 300,
],
[
fn() => [
'style' => VideoStyle::make('cover', 400, 300, LaruploadMediaStyle::SCALE_HEIGHT, new X264(), true),
'width' => 400,
'height' => 300
Expand Down
26 changes: 13 additions & 13 deletions tests/Unit/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,79 +70,79 @@ function dominant(UploadedFile $file, LaruploadImageLibrary $library, string $ex
->toHaveKey('height', $height);

})->with([
[
fn() => [
'file' => jpg(),
'style' => ImageStyle::make('fit', 100, 100, LaruploadMediaStyle::FIT),
'width' => 100,
'height' => 100
],
[
fn() => [
'file' => jpg(),
'style' => ImageStyle::make('fit', 100, 100, LaruploadMediaStyle::AUTO),
'width' => 100,
'height' => 73
],
[
fn() => [
'file' => jpg(),
'style' => ImageStyle::make('fit', null, 100, LaruploadMediaStyle::SCALE_WIDTH),
'width' => 136,
'height' => 100
],
[
fn() => [
'file' => jpg(),
'style' => ImageStyle::make('fit', 100, null, LaruploadMediaStyle::SCALE_HEIGHT),
'width' => 100,
'height' => 73
],
[
fn() => [
'file' => jpg(),
'style' => ImageStyle::make('fit', 100, 100, LaruploadMediaStyle::CROP),
'width' => 100,
'height' => 100
],
[
fn() => [
'file' => jpg(),
'style' => ImageStyle::make('fit', 100, 100),
'width' => 100,
'height' => 73
],
[
fn() => [
'file' => jpg(),
'style' => ImageStyle::make('fit', 100, null, LaruploadMediaStyle::AUTO),
'width' => 100,
'height' => 73
],
[
fn() => [
'file' => jpg(),
'style' => ImageStyle::make('fit', null, 100, LaruploadMediaStyle::AUTO),
'width' => 1077,
'height' => 791
],
[
fn() => [
'file' => jpg(),
'style' => ImageStyle::make('fit', null, 100, LaruploadMediaStyle::AUTO),
'width' => 1077,
'height' => 791
],
[
fn() => [
'file' => squareImage(),
'style' => ImageStyle::make('fit', 101, 100, LaruploadMediaStyle::AUTO),
'width' => 101,
'height' => 101
],
[
fn() => [
'file' => squareImage(),
'style' => ImageStyle::make('fit', 105, 106, LaruploadMediaStyle::AUTO),
'width' => 106,
'height' => 106
],
[
fn() => [
'file' => squareImage(),
'style' => ImageStyle::make('fit', 50, 50, LaruploadMediaStyle::AUTO),
'width' => 50,
'height' => 50
],
[
fn() => [
'file' => verticalImage(),
'style' => ImageStyle::make('fit', 120, 100, LaruploadMediaStyle::AUTO),
'width' => 76,
Expand Down

0 comments on commit c1e588a

Please sign in to comment.