public function ConvolutionTest::testConvolutionEffectParameters in Image Effects 8.2
Same name and namespace in other branches
- 8.3 tests/src/Functional/Effect/ConvolutionTest.php \Drupal\Tests\image_effects\Functional\Effect\ConvolutionTest::testConvolutionEffectParameters()
- 8 tests/src/Functional/Effect/ConvolutionTest.php \Drupal\Tests\image_effects\Functional\Effect\ConvolutionTest::testConvolutionEffectParameters()
Test convolution effect parameters.
File
- tests/
src/ Functional/ Effect/ ConvolutionTest.php, line 94
Class
- ConvolutionTest
- Convolution effect test.
Namespace
Drupal\Tests\image_effects\Functional\EffectCode
public function testConvolutionEffectParameters() {
// Add convolution effect to the test image style.
$effect = [
'id' => 'image_effects_convolution',
'data' => [
'kernel][entries][0][0' => 0,
'kernel][entries][0][1' => 1,
'kernel][entries][0][2' => 2,
'kernel][entries][1][0' => 3,
'kernel][entries][1][1' => 4,
'kernel][entries][1][2' => 5,
'kernel][entries][2][0' => 6,
'kernel][entries][2][1' => 7,
'kernel][entries][2][2' => 8,
'divisor' => 9,
'offset' => 0,
'label' => 'test_convolution',
],
];
$uuid = $this
->addEffectToTestStyle($effect);
// Assert that effect is configured as expected.
$effect_configuration_data = $this->testImageStyle
->getEffect($uuid)
->getConfiguration()['data'];
$this
->assertEqual([
[
0,
1,
2,
],
[
3,
4,
5,
],
[
6,
7,
8,
],
], $effect_configuration_data['kernel']);
$this
->assertEqual(9, $effect_configuration_data['divisor']);
$this
->assertEqual(0, $effect_configuration_data['offset']);
$this
->assertEqual('test_convolution', $effect_configuration_data['label']);
}