Wähle das Vorschaubild auch aus der Website-Datei eines Films ohne Fassung
Die Filmstelle konnte nur aus der Datei einer Inhaltsfassung gezogen werden; ein Medium mit reiner Website-Datei hatte keine Quelle. Jetzt zieht die Auswahl die Stelle aus der Website-Datei (Herkunft frame:0@Sekunde, bestehende Leser bleiben gültig). Die Vorschau des Einzelbilds liegt hinter einer Redaktions-Route. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
be932c113a
commit
5e28538551
7 files changed
+142
-6
No files matched your search
@@ -7,6 +7,7 @@
|
||||
use App\Domain\Catalog\DomainRuleException;
|
||||
use App\Domain\Entitlement\Grant;
|
||||
use App\Domain\Media\PresentationFile;
|
||||
use App\Domain\Media\ThumbnailDeriver;
|
||||
use App\Domain\Media\WebsiteMedia;
|
||||
use App\Domain\Media\WebsiteRelease;
|
||||
use App\Filament\Resources\ContentElements\Pages\ViewContentElement;
|
||||
@@ -186,6 +187,54 @@ public function test_a_versionless_film_shows_its_website_file_in_the_media_mana
|
||||
$this->get($url, ['Range' => 'bytes=50-60'])->assertStatus(416);
|
||||
}
|
||||
|
||||
public function test_a_film_frame_of_the_website_file_becomes_the_preview_image(): void
|
||||
{
|
||||
$image = imagecreatetruecolor(4, 4);
|
||||
ob_start();
|
||||
imagejpeg($image);
|
||||
$jpeg = ob_get_clean();
|
||||
imagedestroy($image);
|
||||
$this->app->bind(ThumbnailDeriver::class, fn () => new class($jpeg) extends ThumbnailDeriver
|
||||
{
|
||||
public function __construct(private string $jpeg) {}
|
||||
|
||||
public function jpegAtWebsiteFile(ContentElement $element, float $seconds): ?string
|
||||
{
|
||||
return $this->jpeg;
|
||||
}
|
||||
});
|
||||
$film = app(ContentService::class)->createElement('film', 'film', 'Trailer');
|
||||
$film->preview_path = 'teaser/'.$film->id.'/datei.mp4';
|
||||
$film->save();
|
||||
Storage::disk('media_derived')->put($film->preview_path, 'x');
|
||||
$this->actingAs($this->editor(), 'staff');
|
||||
|
||||
Livewire::test(ViewContentElement::class, ['record' => $film->getKey()])
|
||||
->set('bereich', 'vorschaubild')
|
||||
->assertSee('Diese Stelle übernehmen')
|
||||
->assertSee('Aus der Website-Datei')
|
||||
->set('frameSecond', '12.5')
|
||||
->call('adoptFrame')
|
||||
->assertSet('pictureFeedback', 'Das Vorschaubild ist gespeichert. Die Fassung bleibt unverändert.');
|
||||
|
||||
$film->refresh();
|
||||
$this->assertSame('vorschau/element-'.$film->id.'.jpg', $film->thumbnail_path);
|
||||
$this->assertSame('frame:0@12.5', $film->thumbnail_source);
|
||||
$this->assertSame(0, $film->versions()->count());
|
||||
Storage::disk('media_derived')->assertExists($film->thumbnail_path);
|
||||
}
|
||||
|
||||
public function test_the_frame_of_the_website_file_is_only_available_to_editors_and_for_a_film_with_a_file(): void
|
||||
{
|
||||
$film = app(ContentService::class)->createElement('film', 'film', 'Ohne Datei');
|
||||
|
||||
$this->get(route('content.website-frame', ['element' => $film, 'sekunde' => 3]))->assertRedirect();
|
||||
|
||||
$this->actingAs($this->editor(), 'staff');
|
||||
$this->get(route('content.website-frame', ['element' => $film, 'sekunde' => 3]))->assertNotFound();
|
||||
$this->get(route('content.website-frame', ['element' => $film]))->assertNotFound();
|
||||
}
|
||||
|
||||
public function test_the_website_file_is_not_served_to_guests_or_without_a_file(): void
|
||||
{
|
||||
Storage::disk('media_derived')->put('teaser/1/datei.mp4', 'x');
|
||||
|
||||
Reference in new issue
Block a user