public function FocalPointEffectsTest::calculateAnchorProvider in Focal Point 8
Data provider for testCalculateAnchor().
See also
FocalPointEffectsTest::testCalculateAnchor()
File
- tests/
src/ Unit/ Effects/ FocalPointEffectsTest.php, line 237
Class
- FocalPointEffectsTest
- Tests the Focal Point image effects.
Namespace
Drupal\Tests\focal_point\Unit\EffectsCode
public function calculateAnchorProvider() {
$data = [];
// @codingStandardsIgnoreStart
// Square image with square crop.
$original_image_size = [
'width' => 2000,
'height' => 2000,
];
$cropped_image_size = [
'width' => 1000,
'height' => 1000,
];
list($top, $left, $center, $bottom, $right) = [
100,
100,
1000,
1900,
1900,
];
$data['square_image_with_square_crop__top_left'] = [
[
'x' => $left,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 0,
],
];
$data['square_image_with_square_crop__top_center'] = [
[
'x' => $center,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 500,
'y' => 0,
],
];
$data['square_image_with_square_crop__top_right'] = [
[
'x' => $right,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1000,
'y' => 0,
],
];
$data['square_image_with_square_crop__center_left'] = [
[
'x' => $left,
'y' => $center,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 500,
],
];
$data['square_image_with_square_crop__center_center'] = [
[
'x' => $center,
'y' => $center,
],
$original_image_size,
$cropped_image_size,
[
'x' => 500,
'y' => 500,
],
];
$data['square_image_with_square_crop__center_right'] = [
[
'x' => $right,
'y' => $center,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1000,
'y' => 500,
],
];
$data['square_image_with_square_crop__bottom_left'] = [
[
'x' => $left,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 1000,
],
];
$data['square_image_with_square_crop__bottom_center'] = [
[
'x' => $center,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 500,
'y' => 1000,
],
];
$data['square_image_with_square_crop__bottom_right'] = [
[
'x' => $right,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1000,
'y' => 1000,
],
];
// Square image with horizontal crop.
$original_image_size = [
'width' => 2000,
'height' => 2000,
];
$cropped_image_size = [
'width' => 1000,
'height' => 250,
];
list($top, $left, $center, $bottom, $right) = [
100,
100,
1000,
1900,
1900,
];
$data['square_image_with_horizontal_crop__top_left'] = [
[
'x' => $left,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 0,
],
];
$data['square_image_with_horizontal_crop__top_center'] = [
[
'x' => $center,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 500,
'y' => 0,
],
];
$data['square_image_with_horizontal_crop__top_right'] = [
[
'x' => $right,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1000,
'y' => 0,
],
];
$data['square_image_with_horizontal_crop__center_left'] = [
[
'x' => $left,
'y' => $center,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 875,
],
];
$data['square_image_with_horizontal_crop__center_center'] = [
[
'x' => $center,
'y' => $center,
],
$original_image_size,
$cropped_image_size,
[
'x' => 500,
'y' => 875,
],
];
$data['square_image_with_horizontal_crop__center_right'] = [
[
'x' => $right,
'y' => $center,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1000,
'y' => 875,
],
];
$data['square_image_with_horizontal_crop__bottom_left'] = [
[
'x' => $left,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 1750,
],
];
$data['square_image_with_horizontal_crop__bottom_center'] = [
[
'x' => $center,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 500,
'y' => 1750,
],
];
$data['square_image_with_horizontal_crop__bottom_right'] = [
[
'x' => $right,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1000,
'y' => 1750,
],
];
// Square image with vertical crop.
$original_image_size = [
'width' => 2000,
'height' => 2000,
];
$cropped_image_size = [
'width' => 100,
'height' => 500,
];
list($top, $left, $center, $bottom, $right) = [
100,
100,
1000,
1900,
1900,
];
$data['square_image_with_vertical_crop__top_left'] = [
[
'x' => $left,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 50,
'y' => 0,
],
];
$data['square_image_with_vertical_crop__top_center'] = [
[
'x' => $center,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 950,
'y' => 0,
],
];
$data['square_image_with_vertical_crop__top_right'] = [
[
'x' => $right,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1850,
'y' => 0,
],
];
$data['square_image_with_vertical_crop__center_left'] = [
[
'x' => $left,
'y' => $center,
],
$original_image_size,
$cropped_image_size,
[
'x' => 50,
'y' => 750,
],
];
$data['square_image_with_vertical_crop__center_center'] = [
[
'x' => $center,
'y' => $center,
],
$original_image_size,
$cropped_image_size,
[
'x' => 950,
'y' => 750,
],
];
$data['square_image_with_vertical_crop__center_right'] = [
[
'x' => $right,
'y' => $center,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1850,
'y' => 750,
],
];
$data['square_image_with_vertical_crop__bottom_left'] = [
[
'x' => $left,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 50,
'y' => 1500,
],
];
$data['square_image_with_vertical_crop__bottom_center'] = [
[
'x' => $center,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 950,
'y' => 1500,
],
];
$data['square_image_with_vertical_crop__bottom_right'] = [
[
'x' => $right,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1850,
'y' => 1500,
],
];
// Horizontal image with square crop.
$original_image_size = [
'width' => 1500,
'height' => 500,
];
$cropped_image_size = [
'width' => 200,
'height' => 200,
];
list($top, $left, $vcenter, $hcenter, $bottom, $right) = [
10,
10,
250,
750,
490,
1490,
];
$data['horizontal_image_with_square_crop__top_left'] = [
[
'x' => $left,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 0,
],
];
$data['horizontal_image_with_square_crop__top_center'] = [
[
'x' => $hcenter,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 650,
'y' => 0,
],
];
$data['horizontal_image_with_square_crop__top_right'] = [
[
'x' => $right,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1300,
'y' => 0,
],
];
$data['horizontal_image_with_square_crop__center_left'] = [
[
'x' => $left,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 150,
],
];
$data['horizontal_image_with_square_crop__center_center'] = [
[
'x' => $hcenter,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 650,
'y' => 150,
],
];
$data['horizontal_image_with_square_crop__center_right'] = [
[
'x' => $right,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1300,
'y' => 150,
],
];
$data['horizontal_image_with_square_crop__bottom_left'] = [
[
'x' => $left,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 300,
],
];
$data['horizontal_image_with_square_crop__bottom_center'] = [
[
'x' => $hcenter,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 650,
'y' => 300,
],
];
$data['horizontal_image_with_square_crop__bottom_right'] = [
[
'x' => $right,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 1300,
'y' => 300,
],
];
// Horizontal image with horizontal crop.
$original_image_size = [
'width' => 1024,
'height' => 768,
];
$cropped_image_size = [
'width' => 800,
'height' => 50,
];
list($top, $left, $vcenter, $hcenter, $bottom, $right) = [
10,
10,
384,
512,
750,
1000,
];
$data['horizontal_image_with_horizontal_crop__top_left'] = [
[
'x' => $left,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 0,
],
];
$data['horizontal_image_with_horizontal_crop__top_center'] = [
[
'x' => $hcenter,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 112,
'y' => 0,
],
];
$data['horizontal_image_with_horizontal_crop__top_right'] = [
[
'x' => $right,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 224,
'y' => 0,
],
];
$data['horizontal_image_with_horizontal_crop__center_left'] = [
[
'x' => $left,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 359,
],
];
$data['horizontal_image_with_horizontal_crop__center_center'] = [
[
'x' => $hcenter,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 112,
'y' => 359,
],
];
$data['horizontal_image_with_horizontal_crop__center_right'] = [
[
'x' => $right,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 224,
'y' => 359,
],
];
$data['horizontal_image_with_horizontal_crop__bottom_left'] = [
[
'x' => $left,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 718,
],
];
$data['horizontal_image_with_horizontal_crop__bottom_center'] = [
[
'x' => $hcenter,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 112,
'y' => 718,
],
];
$data['horizontal_image_with_horizontal_crop__bottom_right'] = [
[
'x' => $right,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 224,
'y' => 718,
],
];
// Horizontal image with vertical crop.
$original_image_size = [
'width' => 1024,
'height' => 768,
];
$cropped_image_size = [
'width' => 313,
'height' => 600,
];
list($top, $left, $vcenter, $hcenter, $bottom, $right) = [
10,
10,
384,
512,
750,
1000,
];
$data['horizontal_image_with_vertical_crop__top_left'] = [
[
'x' => $left,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 0,
],
];
$data['horizontal_image_with_vertical_crop__top_center'] = [
[
'x' => $hcenter,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 355,
'y' => 0,
],
];
$data['horizontal_image_with_vertical_crop__top_right'] = [
[
'x' => $right,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 711,
'y' => 0,
],
];
$data['horizontal_image_with_vertical_crop__center_left'] = [
[
'x' => $left,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 84,
],
];
$data['horizontal_image_with_vertical_crop__center_center'] = [
[
'x' => $hcenter,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 355,
'y' => 84,
],
];
$data['horizontal_image_with_vertical_crop__center_right'] = [
[
'x' => $right,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 711,
'y' => 84,
],
];
$data['horizontal_image_with_vertical_crop__bottom_left'] = [
[
'x' => $left,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 168,
],
];
$data['horizontal_image_with_vertical_crop__bottom_center'] = [
[
'x' => $hcenter,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 355,
'y' => 168,
],
];
$data['horizontal_image_with_vertical_crop__bottom_right'] = [
[
'x' => $right,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 711,
'y' => 168,
],
];
// Vertical image with square crop.
$original_image_size = [
'width' => 500,
'height' => 2500,
];
$cropped_image_size = [
'width' => 100,
'height' => 100,
];
list($top, $left, $vcenter, $hcenter, $bottom, $right) = [
50,
50,
1250,
250,
2450,
450,
];
$data['vertical_image_with_square_crop__top_left'] = [
[
'x' => $left,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 0,
],
];
$data['vertical_image_with_square_crop__top_center'] = [
[
'x' => $hcenter,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 200,
'y' => 0,
],
];
$data['vertical_image_with_square_crop__top_right'] = [
[
'x' => $right,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 400,
'y' => 0,
],
];
$data['vertical_image_with_square_crop__center_left'] = [
[
'x' => $left,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 1200,
],
];
$data['vertical_image_with_square_crop__center_center'] = [
[
'x' => $hcenter,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 200,
'y' => 1200,
],
];
$data['vertical_image_with_square_crop__center_right'] = [
[
'x' => $right,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 400,
'y' => 1200,
],
];
$data['vertical_image_with_square_crop__bottom_left'] = [
[
'x' => $left,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 2400,
],
];
$data['vertical_image_with_square_crop__bottom_center'] = [
[
'x' => $hcenter,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 200,
'y' => 2400,
],
];
$data['vertical_image_with_square_crop__bottom_right'] = [
[
'x' => $right,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 400,
'y' => 2400,
],
];
// Vertical image with horizontal crop.
$original_image_size = [
'width' => 1111,
'height' => 313,
];
$cropped_image_size = [
'width' => 400,
'height' => 73,
];
list($top, $left, $vcenter, $hcenter, $bottom, $right) = [
10,
10,
384,
512,
750,
1000,
];
$data['vertical_image_with_horizontal_crop__top_left'] = [
[
'x' => $left,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 0,
],
];
$data['vertical_image_with_horizontal_crop__top_center'] = [
[
'x' => $hcenter,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 312,
'y' => 0,
],
];
$data['vertical_image_with_horizontal_crop__top_right'] = [
[
'x' => $right,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 711,
'y' => 0,
],
];
$data['vertical_image_with_horizontal_crop__center_left'] = [
[
'x' => $left,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 240,
],
];
$data['vertical_image_with_horizontal_crop__center_center'] = [
[
'x' => $hcenter,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 312,
'y' => 240,
],
];
$data['vertical_image_with_horizontal_crop__center_right'] = [
[
'x' => $right,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 711,
'y' => 240,
],
];
$data['vertical_image_with_horizontal_crop__bottom_left'] = [
[
'x' => $left,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 240,
],
];
$data['vertical_image_with_horizontal_crop__bottom_center'] = [
[
'x' => $hcenter,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 312,
'y' => 240,
],
];
$data['vertical_image_with_horizontal_crop__bottom_right'] = [
[
'x' => $right,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 711,
'y' => 240,
],
];
// Vertical image with vertical crop.
$original_image_size = [
'width' => 200,
'height' => 2000,
];
$cropped_image_size = [
'width' => 100,
'height' => 1111,
];
list($top, $left, $vcenter, $hcenter, $bottom, $right) = [
10,
10,
384,
512,
750,
1000,
];
$data['vertical_image_with_vertical_crop__top_left'] = [
[
'x' => $left,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 0,
],
];
$data['vertical_image_with_vertical_crop__top_center'] = [
[
'x' => $hcenter,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 100,
'y' => 0,
],
];
$data['vertical_image_with_vertical_crop__top_right'] = [
[
'x' => $right,
'y' => $top,
],
$original_image_size,
$cropped_image_size,
[
'x' => 100,
'y' => 0,
],
];
$data['vertical_image_with_vertical_crop__center_left'] = [
[
'x' => $left,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 0,
],
];
$data['vertical_image_with_vertical_crop__center_center'] = [
[
'x' => $hcenter,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 100,
'y' => 0,
],
];
$data['vertical_image_with_vertical_crop__center_right'] = [
[
'x' => $right,
'y' => $vcenter,
],
$original_image_size,
$cropped_image_size,
[
'x' => 100,
'y' => 0,
],
];
$data['vertical_image_with_vertical_crop__bottom_left'] = [
[
'x' => $left,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 0,
'y' => 194,
],
];
$data['vertical_image_with_vertical_crop__bottom_center'] = [
[
'x' => $hcenter,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 100,
'y' => 194,
],
];
$data['vertical_image_with_vertical_crop__bottom_right'] = [
[
'x' => $right,
'y' => $bottom,
],
$original_image_size,
$cropped_image_size,
[
'x' => 100,
'y' => 194,
],
];
// @codingStandardsIgnoreEnd
return $data;
}