aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/preview/txt.php
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-06-06 16:21:36 +0200
committerOlivier Paroz <github@oparoz.com>2015-06-06 16:25:04 +0200
commit71d65cb713ebfb85ee19f9f3cd17dd915360fe9b (patch)
tree7281b8a32d148d27ae375dd1c45308416e63eee7 /tests/lib/preview/txt.php
parent16708ae1873ddd563c3177b87cf7a4c395dca609 (diff)
downloadnextcloud-server-71d65cb713ebfb85ee19f9f3cd17dd915360fe9b.tar.gz
nextcloud-server-71d65cb713ebfb85ee19f9f3cd17dd915360fe9b.zip
Fix max preview, some resizing and caching issues and force preview providers to resize their previews properly
* introduces a method in OC_Image which doesn't stretch images when trying to make them fit in a box * adds the method to all key providers so that they can do their job, as expected by the Preview class * improves the caching mechanism of Preview in order to reduce I/O and to avoid filling the available disk space * fixes some long standing issues * **contains mostly tests**
Diffstat (limited to 'tests/lib/preview/txt.php')
-rw-r--r--tests/lib/preview/txt.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/lib/preview/txt.php b/tests/lib/preview/txt.php
new file mode 100644
index 00000000000..8bda86f25e3
--- /dev/null
+++ b/tests/lib/preview/txt.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * @author Olivier Paroz <owncloud@interfasys.ch>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace Test\Preview;
+
+class TXT extends Provider {
+
+ public function setUp() {
+ parent::setUp();
+
+ $fileName = 'lorem-big.txt';
+ $this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
+ // Arbitrary width and length which won't be used to calculate the ratio
+ $this->width = 500;
+ $this->height = 200;
+ $this->provider = new \OC\Preview\TXT;
+ }
+
+}