From 9b64fa7f124b6af2e752e9924b32e0a87a07f82a Mon Sep 17 00:00:00 2001 From: Aditya Rana Date: Thu, 11 Nov 2021 19:41:56 +0530 Subject: [PATCH] Added test for negative angle values (-315deg equivalent to 45deg test case). --- tests/e2e/Services/Storage/StorageBase.php | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index 395eb8ce4f..b58e235eaf 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -144,6 +144,31 @@ trait StorageBase $this->assertEquals('image/png', $file6['headers']['content-type']); $this->assertNotEmpty($file6['body']); + // Test for negative angle values in fileGetPreview + $file7 = $this->client->call(Client::METHOD_GET, '/storage/files/' . $data['fileId'] . '/preview', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'width' => 300, + 'height' => 100, + 'borderRadius' => '50', + 'opacity' => '0.5', + 'output' => 'png', + 'rotation' => '-315', + ]); + + $this->assertEquals(200, $file7['headers']['status-code']); + $this->assertEquals('image/png', $file7['headers']['content-type']); + $this->assertNotEmpty($file7['body']); + + $image = new \Imagick(); + $image->readImageBlob($file7['body']); + $original = new \Imagick(__DIR__ . '/../../../resources/logo-after.png'); + + $this->assertEquals($image->getImageWidth(), $original->getImageWidth()); + $this->assertEquals($image->getImageHeight(), $original->getImageHeight()); + $this->assertEquals('PNG', $image->getImageFormat()); + /** * Test for FAILURE */