// Flush Image object to disk storage.
$file_path =
$this->directory . '/' .
$test_case .
image_type_to_extension($image->
getToolkit()->
getType());
$image->
save($file_path);
// Check that the both the GD object and the Image object have an accurate
// record of the dimensions.
if (isset($expected['height'
]) &&
isset($expected['width'
])) { $this->
assertSame($expected['height'
],
imagesy($toolkit->
getResource()), "Image '
$file_name' after '
$test_case' should have a proper height."
);
$this->
assertSame($expected['width'
],
imagesx($toolkit->
getResource()), "Image '
$file_name' after '
$test_case' should have a proper width."
);
$this->
assertSame($expected['height'
],
$image->
getHeight(), "Image '
$file_name' after '
$test_case' should have a proper height."
);
$this->
assertSame($expected['width'
],
$image->
getWidth(), "Image '
$file_name' after '
$test_case' should have a proper width."
);
} // Now check each of the corners to ensure color correctness.
foreach ($expected['corners'
] as $key =>
$expected_color) { // The test gif that does not have transparency color set is a
// special case.
if ($file_name === 'image-test-no-transparency.gif'
) { 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;
}