Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-03-17 11:40:59 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2014-03-17 11:40:59 +0400
commitcd038604d396b7611353041cb8ed033f23fe305b (patch)
treec896065b4754a8d4bb22ddd060878ac107f3ae7e /tests
parent79ba930ef90d3e54c02f62c43f61c190e11fb4ec (diff)
unit tests for specific image type output added
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/image.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/lib/image.php b/tests/lib/image.php
index 4aba1b0bc61..131a9d86f3e 100644
--- a/tests/lib/image.php
+++ b/tests/lib/image.php
@@ -8,8 +8,8 @@
class Test_Image extends PHPUnit_Framework_TestCase {
public static function tearDownAfterClass() {
- unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
- unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
+ @unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
+ @unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
}
public function testGetMimeTypeForFile() {
@@ -236,4 +236,24 @@ class Test_Image extends PHPUnit_Framework_TestCase {
$this->assertEquals(200, $img->width());
$this->assertEquals(200, $img->height());
}
+
+ function convertDataProvider() {
+ return array(
+ array( 'image/gif'),
+ array( 'image/jpeg'),
+ array( 'image/png'),
+ );
+ }
+
+ /**
+ * @dataProvider convertDataProvider
+ */
+ public function testConvert($mimeType) {
+ $img = new \OC_Image(OC::$SERVERROOT.'/tests/data/testimage.png');
+ $tempFile = tempnam(sys_get_temp_dir(), 'img-test');
+
+ $img->save($tempFile, $mimeType);
+ $actualMimeType = \OC_Image::getMimeTypeForFile($tempFile);
+ $this->assertEquals($mimeType, $actualMimeType);
+ }
}