fix(generator): set slide size and PresentationSlide chordChart

This commit is contained in:
Thorsten Bus 2026-03-30 08:03:54 +02:00
parent e2cebe419c
commit e46e7e5f9c

View file

@ -755,4 +755,106 @@ class ProFileGeneratorTest extends TestCase
$presentationSlide = $action->getSlide()->getPresentation();
$this->assertNotNull($presentationSlide->getChordChart());
}
#[Test]
public function testBuildLocalRelativePathMappedDirectory(): void
{
// Test: Known directory mapping (Downloads) → ROOT_USER_DOWNLOADS with correct relative path
$song = ProFileGenerator::generate(
'Mapped Path Test',
[
[
'name' => 'V1',
'color' => [0, 0, 0, 1],
'slides' => [
[
'media' => 'file:///Users/testuser/Downloads/test-image.jpg',
'format' => 'JPG',
],
],
],
],
[
['name' => 'normal', 'groupNames' => ['V1']],
],
);
// Navigate to the first slide's media action
$cue = $song->getPresentation()->getCues()[0];
$action = $cue->getActions()[0]; // media action
$url = $action->getMedia()->getUrl();
$this->assertNotNull($url);
$this->assertNotNull($url->getLocal());
$this->assertSame(4, $url->getLocal()->getRoot()); // ROOT_USER_DOWNLOADS = 4
$this->assertSame('test-image.jpg', $url->getLocal()->getPath());
}
#[Test]
public function testBuildLocalRelativePathUnmappedUserDirectory(): void
{
// Test: Unmapped user directory (AI) → ROOT_USER_HOME with full relative path
$song = ProFileGenerator::generate(
'Unmapped Path Test',
[
[
'name' => 'V1',
'color' => [0, 0, 0, 1],
'slides' => [
[
'media' => 'file:///Users/thorsten/AI/propresenter/ref/Media/test.png',
'format' => 'PNG',
],
],
],
],
[
['name' => 'normal', 'groupNames' => ['V1']],
],
);
// Navigate to the first slide's media action
$cue = $song->getPresentation()->getCues()[0];
$action = $cue->getActions()[0]; // media action
$url = $action->getMedia()->getUrl();
$this->assertNotNull($url);
$this->assertNotNull($url->getLocal());
$this->assertSame(2, $url->getLocal()->getRoot()); // ROOT_USER_HOME = 2
$this->assertSame('AI/propresenter/ref/Media/test.png', $url->getLocal()->getPath());
}
#[Test]
public function testBuildLocalRelativePathNonUserPath(): void
{
// Test: Non-user path (tmp) → ROOT_BOOT_VOLUME with full path
$song = ProFileGenerator::generate(
'Non-User Path Test',
[
[
'name' => 'V1',
'color' => [0, 0, 0, 1],
'slides' => [
[
'media' => 'file:///tmp/test-image.jpg',
'format' => 'JPG',
],
],
],
],
[
['name' => 'normal', 'groupNames' => ['V1']],
],
);
// Navigate to the first slide's media action
$cue = $song->getPresentation()->getCues()[0];
$action = $cue->getActions()[0]; // media action
$url = $action->getMedia()->getUrl();
$this->assertNotNull($url);
$this->assertNotNull($url->getLocal());
$this->assertSame(1, $url->getLocal()->getRoot()); // ROOT_BOOT_VOLUME = 1
$this->assertSame('tmp/test-image.jpg', $url->getLocal()->getPath());
}
}