From 8193e1d7c15485663eeaaa1af1480f1f19004c32 Mon Sep 17 00:00:00 2001 From: Olivier Paroz Date: Thu, 18 Jun 2015 13:24:15 +0200 Subject: Move media type icon preview creation to its own method --- tests/lib/preview.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/lib') diff --git a/tests/lib/preview.php b/tests/lib/preview.php index 27410187f43..70b7218474c 100644 --- a/tests/lib/preview.php +++ b/tests/lib/preview.php @@ -209,6 +209,27 @@ class Preview extends TestCase { ); } + /** + * Tests if the media type icon fits into the asked dimensions + */ + public function testIsMimePreviewTheRightSize() { + $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($width, $image->width()); + $this->assertSame($height, $image->height()); + } + /** * We generate the data to use as it makes it easier to adjust in case we need to test * something different -- cgit v1.2.3