function testCropTopCenter() { $cropper = TestTimberImage::copyTestImage('cropper.png'); $resized = TimberImageHelper::resize($cropper, 300, 100, 'top-center'); $resized = str_replace('http://example.org', '', $resized); $resized = TimberUrlHelper::url_to_file_system($resized); $is_red = TestTimberImage::checkPixel($resized, 100, 50, '#ff0000', '#ff0800'); $this->assertTrue($is_red); }
function testCropBottom() { $cropper = TestTimberImage::copyTestImage('cropper.png'); $resized = TimberImageHelper::resize($cropper, 300, 100, 'bottom'); $resized = str_replace('http://example.org', '', $resized); $resized = TimberUrlHelper::url_to_file_system($resized); $is_teal = TestTimberImage::checkPixel($resized, 290, 90, '#00ffff'); $this->assertTrue($is_teal); }
function testLetterboxGif() { $base_file = 'panam.gif'; $file_loc = TestTimberImage::copyTestImage($base_file); $upload_dir = wp_upload_dir(); $new_file = TimberImageHelper::letterbox($upload_dir['url'] . '/' . $base_file, 300, 100, '00FF00', true); $location_of_image = TimberImageHelper::get_server_location($new_file); $this->assertTrue(TestTimberImage::checkSize($location_of_image, 300, 100)); //whats the bg/color of the image $this->assertTrue(TestTimberImage::checkPixel($location_of_image, 50, 10, "#00FF00", "#00FF10")); $this->assertFileExists($location_of_image); }