aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2023-06-06 23:12:40 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2023-06-23 16:27:35 +0200
commit440f882322562af6040c0c4634903574f572f146 (patch)
tree47bd477996f24fe4417ba4377e384f490250d0ea /tests
parent05f360c5ec76bf87f55bdbc0385aa7972ec11cbd (diff)
downloadnextcloud-server-440f882322562af6040c0c4634903574f572f146.tar.gz
nextcloud-server-440f882322562af6040c0c4634903574f572f146.zip
feat: add width, height, crop and mode to BeforePreviewFetchedEvent
user_usage_report keeps a counter for files read. The app uses - OC_Filesystem::read hook - Event listener (the legacy one) for IPreview::EVENT Request for previews do not trigger the hook, hence the additional event listener. The thumbnails for a list or grid view should not count, so we need the width and height. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Preview/GeneratorTest.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php
index 37fc3935139..2216674a34c 100644
--- a/tests/lib/Preview/GeneratorTest.php
+++ b/tests/lib/Preview/GeneratorTest.php
@@ -125,7 +125,7 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file));
+ ->with(new BeforePreviewFetchedEvent($file, 100, 100, false, IPreview::MODE_FILL));
$result = $this->generator->getPreview($file, 100, 100);
$this->assertSame($previewFile, $result);
@@ -264,7 +264,7 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file));
+ ->with(new BeforePreviewFetchedEvent($file, 100, 100, false, IPreview::MODE_FILL));
$result = $this->generator->getPreview($file, 100, 100);
$this->assertSame($previewFile, $result);
@@ -316,7 +316,7 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file));
+ ->with(new BeforePreviewFetchedEvent($file, 1024, 512, true, IPreview::MODE_COVER));
$this->generator->getPreview($file, 1024, 512, true, IPreview::MODE_COVER, 'invalidType');
}
@@ -366,7 +366,7 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file));
+ ->with(new BeforePreviewFetchedEvent($file, 1024, 512, true, IPreview::MODE_COVER));
$result = $this->generator->getPreview($file, 1024, 512, true, IPreview::MODE_COVER, 'invalidType');
$this->assertSame($preview, $result);
@@ -405,7 +405,7 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file));
+ ->with(new BeforePreviewFetchedEvent($file, 100, 100, false, IPreview::MODE_FILL));
$this->expectException(NotFoundException::class);
$this->generator->getPreview($file, 100, 100);
@@ -543,7 +543,7 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file));
+ ->with(new BeforePreviewFetchedEvent($file, $reqX, $reqY, $crop, $mode));
$result = $this->generator->getPreview($file, $reqX, $reqY, $crop, $mode);
if ($expectedX === $maxX && $expectedY === $maxY) {