You are here

public function FocalPointFieldWidgetTest::providerValidateFocalPoint in Focal Point 8

Data provider for testFocalPoint().

File

tests/src/Unit/FieldWidgets/FocalPointFieldWidgetTest.php, line 105

Class

FocalPointFieldWidgetTest
@coversDefaultClass \Drupal\focal_point\Plugin\Field\FieldWidget\FocalPointImageWidget

Namespace

Drupal\Tests\focal_point\Unit\FieldWidgets

Code

public function providerValidateFocalPoint() {
  $data = [];
  $data['default_focal_point_position'] = [
    '50,50',
    TRUE,
  ];
  $data['basic_focal_point_position_1'] = [
    '75,25',
    TRUE,
  ];
  $data['basic_focal_point_position_2'] = [
    '3,50',
    TRUE,
  ];
  $data['basic_focal_point_position_3'] = [
    '83,6',
    TRUE,
  ];
  $data['basic_focal_point_position_4'] = [
    '2,9',
    TRUE,
  ];
  $data['extreme_focal_point_position_top_right'] = [
    '100,0',
    TRUE,
  ];
  $data['extreme_focal_point_position_top_left'] = [
    '0,0',
    TRUE,
  ];
  $data['extreme_focal_point_position_bottom_right'] = [
    '100,100',
    TRUE,
  ];
  $data['extreme_focal_point_position_bottom_left'] = [
    '0,100',
    TRUE,
  ];
  $data['invalid_focal_point_position_negative_x'] = [
    '-20,50',
    FALSE,
  ];
  $data['invalid_focal_point_position_negative_y'] = [
    '18,-3',
    FALSE,
  ];
  $data['invalid_focal_point_position_out_of_bounds_x'] = [
    '101,33',
    FALSE,
  ];
  $data['invalid_focal_point_position_out_of_bounds_y'] = [
    '44,101',
    FALSE,
  ];
  $data['invalid_focal_point_position_out_of_bounds_xy'] = [
    '313,512',
    FALSE,
  ];
  $data['invalid_focal_point_position_empty'] = [
    '',
    FALSE,
  ];
  $data['invalid_focal_point_position_incorrect_format_1'] = [
    'invalid',
    FALSE,
  ];
  $data['invalid_focal_point_position_incorrect_format_2'] = [
    'invalid,invalid',
    FALSE,
  ];
  $data['invalid_focal_point_position_incorrect_format_3'] = [
    '23,invalid',
    FALSE,
  ];
  return $data;
}