summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-08-01 18:59:59 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-08-01 18:59:59 +0200
commit452b6fe4e06b76d2622056b878a964262715d486 (patch)
treebec98b9ffc7bc1fa7893db51453139e8389a4aa4
parenta1266874b0df706dc92072cc0a371cf7286d488b (diff)
Test \libraries\Image::get_exif_orientation
Also pull in some test files Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--.gitmodules3
-rw-r--r--application/test/tests/test_libraries_image.php15
m---------data/tests/exif-orientation-examples0
3 files changed, 18 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index e9b88c03c..8648cbbb7 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,3 +7,6 @@
[submodule "application/third_party/parsedown"]
path = application/third_party/parsedown
url = https://github.com/erusev/parsedown.git
+[submodule "data/tests/exif-orientation-examples"]
+ path = data/tests/exif-orientation-examples
+ url = https://github.com/recurser/exif-orientation-examples.git
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");
+ }
+ }
+
}
diff --git a/data/tests/exif-orientation-examples b/data/tests/exif-orientation-examples
new file mode 160000
+Subproject 85c6e142ee57d1c5c7a29b2efcd5980a584758e