Skip to content
Permalink
Browse files

A bit more work was needed to make images unit tests pass on my MacOS…

… set up
  • Loading branch information...
chrisgraham committed Aug 14, 2019
1 parent abc0f5a commit b5a4563f61506a5aadacbc6a770c64bb1a8c270d
Showing with 10 additions and 4 deletions.
  1. +10 −4 _tests/tests/unit_tests/images.php
@@ -219,26 +219,32 @@ function runQuadrantTest($file, $convert_width, $convert_height, &$additional_in
return false;
}
// 'corners' will be somewhere in middle of quadrant, biased a bit towards real corner due to blending distortions
$dim_x_min = max(0, intval($dimensions[0] / 4) - 1);
$dim_x_max = min($dimensions[0] - 1, intval($dimensions[0] * 0.75) + 1);
$dim_y_min = max(0, intval($dimensions[1] / 4) - 1);
$dim_y_max = min($dimensions[1] - 1, intval($dimensions[1] * 0.75) + 1);
// Test red quadrant in upper left corner
if (!testColor($image_resource, intval($dimensions[0] / 4), intval($dimensions[1] / 4), 255, 0, 0, 0, 60, $additional_information)) {
if (!testColor($image_resource, $dim_x_min, $dim_y_min, 255, 0, 0, 0, 90, $additional_information)) {
outputDebugVisual($path);
return false;
}
// Test green quadrant in upper right corner
if (!testColor($image_resource, intval($dimensions[0] * 0.75), intval($dimensions[1] / 4), 0, 255, 0, 0, 60, $additional_information)) {
if (!testColor($image_resource, $dim_x_max, $dim_y_min, 0, 255, 0, 0, 90, $additional_information)) {
outputDebugVisual($path);
return false;
}
// Test blue quadrant in lower left corner
if (!testColor($image_resource, intval($dimensions[0] / 4), intval($dimensions[1] * 0.75), 0, 0, 255, 0, 60, $additional_information)) {
if (!testColor($image_resource, $dim_x_min, $dim_y_max, 0, 0, 255, 0, 90, $additional_information)) {
outputDebugVisual($path);
return false;
}
// Test white quadrant in lower right corner
if (!testColor($image_resource, intval($dimensions[0] * 0.75), intval($dimensions[1] * 0.75), 255, 255, 255, 0, 60, $additional_information)) {
if (!testColor($image_resource, $dim_x_max, $dim_y_max, 255, 255, 255, 0, 90, $additional_information)) {
outputDebugVisual($path);
return false;
}

0 comments on commit b5a4563

Please sign in to comment.
You can’t perform that action at this time.