summaryrefslogtreecommitdiffstats
path: root/application/test/tests/test_libraries_exif.php
blob: 3ca821c03ce18393da65b5cc788653802fbbc27e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*
 * Copyright 2016 Florian "Bluewind" Pritz <bluewind@server-speed.net>
 *
 * Licensed under AGPLv3
 * (see COPYING for full license text)
 *
 */

namespace test\tests;

class test_libraries_exif extends \test\Test {

	public function __construct()
	{
		parent::__construct();
	}

	public function init()
	{
	}

	public function cleanup()
	{
	}

	public function test_get_exif_jpeg()
	{
		$ret = \libraries\Exif::get_exif(FCPATH.'/data/tests/exif-orientation-examples/Portrait_1.jpg');

		$this->t->is($ret['Orientation'], 1, "Get correct EXIF Orientation");
		$this->t->is($ret['FileName'], "Portrait_1.jpg", "Get correct EXIF FileName");
	}

	public function test_get_exif_invalidTypes()
	{
		$ret = \libraries\Exif::get_exif(FCPATH.'/data/tests/black_white.png');
		$this->t->is($ret, false, "PNG not supported");
	}

	public function test_get_exif_missingFile()
	{
		$ret = \libraries\Exif::get_exif(FCPATH.'/data/tests/thisFileDoesNotExist');
		$this->t->is($ret, false, "Should return false for missing file");
	}

}