summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2015-06-22 13:55:17 +0200
committerBjörn Schießle <bjoern@schiessle.org>2015-06-22 13:55:17 +0200
commita88b370dc84c4dfdcab7a128900829fbe8204ca7 (patch)
tree38b047800346bd6edbaa77cf833500d6a432156b /tests
parentced15c44b41d3fbaf506d28c506e2db75e57b774 (diff)
parentba3b6f9be40bc3a916e8b163be62fe7530836cee (diff)
downloadnextcloud-server-a88b370dc84c4dfdcab7a128900829fbe8204ca7.tar.gz
nextcloud-server-a88b370dc84c4dfdcab7a128900829fbe8204ca7.zip
Merge pull request #12546 from oparoz/patch-1
Send the mime icon if we can't generate a preview
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/preview.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/preview.php b/tests/lib/preview.php
index 27410187f43..ca7fa6987d6 100644
--- a/tests/lib/preview.php
+++ b/tests/lib/preview.php
@@ -210,6 +210,26 @@ class Preview extends TestCase {
}
/**
+ * Tests if unsupported previews return an empty object
+ */
+ public function testUnsupportedPreviewsReturnEmptyObject() {
+ $width = 400;
+ $height = 200;
+
+ // Previews for odt files are not enabled
+ $imgData = file_get_contents(\OC::$SERVERROOT . '/tests/data/testimage.odt');
+ $imgPath = '/' . self::TEST_PREVIEW_USER1 . '/files/testimage.odt';
+ $this->rootView->file_put_contents($imgPath, $imgData);
+
+ $preview =
+ new \OC\Preview(self::TEST_PREVIEW_USER1, 'files/', 'testimage.odt', $width, $height);
+ $preview->getPreview();
+ $image = $preview->getPreview();
+
+ $this->assertSame(false, $image->valid());
+ }
+
+ /**
* We generate the data to use as it makes it easier to adjust in case we need to test
* something different
*