From 452b6fe4e06b76d2622056b878a964262715d486 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 1 Aug 2016 18:59:59 +0200 Subject: Test \libraries\Image::get_exif_orientation Also pull in some test files Signed-off-by: Florian Pritz --- application/test/tests/test_libraries_image.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'application/test/tests') diff --git a/application/test/tests/test_libraries_image.php b/application/test/tests/test_libraries_image.php index 2b1c20f9c..6891e8d22 100644 --- a/application/test/tests/test_libraries_image.php +++ b/application/test/tests/test_libraries_image.php @@ -66,5 +66,20 @@ class test_libraries_image extends \test\Test { } } } + + public function test_get_exif_orientation() + { + $ret = \libraries\Image::get_exif_orientation(FCPATH."/data/tests/black_white.png"); + $this->t->is($ret, 0, "Got correct Orientation for image without orientation information"); + + foreach ([1,2,3,4,5,6,7,8] as $orientation) { + $ret = \libraries\Image::get_exif_orientation(FCPATH."/data/tests/exif-orientation-examples/Landscape_$orientation.jpg"); + $this->t->is($ret, $orientation, "Got correct Orientation for Landscape_$orientation.jpg"); + + $ret = \libraries\Image::get_exif_orientation(FCPATH."/data/tests/exif-orientation-examples/Portrait_$orientation.jpg"); + $this->t->is($ret, $orientation, "Got correct Orientation for Portrait_$orientation.jpg"); + } + } + } -- cgit v1.2.3-24-g4f1b