From c14638877c0bb0533a72842ccc7c73d88f5122f0 Mon Sep 17 00:00:00 2001 From: Nina Pypchenko <22447785+nina-py@users.noreply.github.com> Date: Sun, 10 Jan 2021 19:14:49 +1100 Subject: Add "Crop image previews" setting to files Added a new user setting that toggles cropping on image previews in grid view. True (default value): crops each image to a square. False: keep original aspect ratio. Signed-off-by: Nina Pypchenko <22447785+nina-py@users.noreply.github.com> Closes #18439. Signed-off-by: npmbuildbot-nextcloud[bot] --- apps/files/tests/Controller/ApiControllerTest.php | 13 +++++++++++++ apps/files/tests/Controller/ViewControllerTest.php | 2 ++ 2 files changed, 15 insertions(+) (limited to 'apps/files/tests') diff --git a/apps/files/tests/Controller/ApiControllerTest.php b/apps/files/tests/Controller/ApiControllerTest.php index afef351aea7..1fb6490f143 100644 --- a/apps/files/tests/Controller/ApiControllerTest.php +++ b/apps/files/tests/Controller/ApiControllerTest.php @@ -246,4 +246,17 @@ class ApiControllerTest extends TestCase { $this->assertEquals($expected, $actual); } + + public function testCropImagePreviews() { + $crop = true; + + $this->config->expects($this->once()) + ->method('setUserValue') + ->with($this->user->getUID(), 'files', 'crop_image_previews', $crop); + + $expected = new Http\Response(); + $actual = $this->apiController->cropImagePreviews($crop); + + $this->assertEquals($expected, $actual); + } } diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index 2b40697642c..fc2b82de9c8 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -135,6 +135,7 @@ class ViewControllerTest extends TestCase { [$this->user->getUID(), 'files', 'file_sorting', 'name', 'name'], [$this->user->getUID(), 'files', 'file_sorting_direction', 'asc', 'asc'], [$this->user->getUID(), 'files', 'show_hidden', false, false], + [$this->user->getUID(), 'files', 'crop_image_previews', true, true], [$this->user->getUID(), 'files', 'show_grid', true], ]); @@ -316,6 +317,7 @@ class ViewControllerTest extends TestCase { 'defaultFileSorting' => 'name', 'defaultFileSortingDirection' => 'asc', 'showHiddenFiles' => 0, + 'cropImagePreviews' => 1, 'fileNotFound' => 0, 'allowShareWithLink' => 'yes', 'appNavigation' => $nav, -- cgit v1.2.3