summaryrefslogtreecommitdiffstats
path: root/application/test/tests
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-05-31 10:41:11 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-31 10:41:11 +0200
commit3281db65cafe150fbe26606ce6b5bd63da87f8a4 (patch)
treee08f1df14d9e2a9195a33374f08d59f127fdf981 /application/test/tests
parent2937bf1a47778ad1b804fee65ff3c9fe5c35ab61 (diff)
test: Add more \libraries\Image tests
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/test/tests')
-rw-r--r--application/test/tests/test_libraries_image.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/application/test/tests/test_libraries_image.php b/application/test/tests/test_libraries_image.php
index 13c9e67b9..cd9098ccc 100644
--- a/application/test/tests/test_libraries_image.php
+++ b/application/test/tests/test_libraries_image.php
@@ -34,5 +34,35 @@ class test_libraries_image extends \test\Test {
$this->t->is(\libraries\Image::type_supported('text/plain'), false, 'text/plain should not be supported');
}
+ public function test_makeThumb_PNG()
+ {
+ $img = new \libraries\Image(FCPATH."/data/tests/black_white.png");
+ $img->makeThumb(150, 150);
+ $thumb = $img->get(IMAGETYPE_PNG);
+
+ $this->t->ok($thumb !== "", "Got thumbnail");
+ }
+
+ public function test_makeThumb_PDF()
+ {
+ $img = new \libraries\Image(FCPATH."/data/tests/simple.pdf");
+ $img->makeThumb(150, 150);
+ $thumb = $img->get(IMAGETYPE_JPEG);
+
+ $this->t->ok($thumb !== "", "Got thumbnail");
+ }
+
+ public function test_makeThumb_binaryFile()
+ {
+ try {
+ $img = new \libraries\Image(FCPATH."/data/tests/message1.bin");
+ } catch (\exceptions\PublicApiException $e) {
+ $correct_error = $e->get_error_id() == "libraries/Image/unsupported-image-type";
+ $this->t->ok($correct_error, "Should get exception");
+ if (!$correct_error) {
+ throw $e;
+ }
+ }
+ }
}