function GdToolkitNoTransparencyGifImageManipulationTest::providerOperationTestCases

Data provider for ::testManipulations().

Overrides GdToolkitImageManipulationTestBase::providerOperationTestCases

File

core/tests/Drupal/KernelTests/Core/Image/GdToolkitNoTransparencyGifImageManipulationTest.php, line 30

Class

GdToolkitNoTransparencyGifImageManipulationTest
GD image toolkit image manipulation of no-transparency GIF images.

Namespace

Drupal\KernelTests\Core\Image

Code

public static function providerOperationTestCases() : array {
  $ret = parent::providerOperationTestCases();
  // The test gif that does not have transparency color set is a special
  // case.
  foreach ($ret as $test_case => &$data) {
    foreach ($data[3]['corners'] as &$expected_color) {
      if ($test_case == 'desaturate') {
        // For desaturating, keep the expected color from the test data, but
        // set alpha channel to fully opaque.
        $expected_color[3] = 0;
      }
      elseif ($expected_color === static::TRANSPARENT) {
        // Set expected pixel to yellow where the others have
        // transparent.
        $expected_color = static::YELLOW;
      }
    }
  }
  return $ret;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.