Added test for negative angle values (-315deg equivalent to 45deg test case).

This commit is contained in:
Aditya Rana
2021-11-11 19:41:56 +05:30
parent 07bdd3e26b
commit 9b64fa7f12
@@ -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
*/