fix(generator): add presentation-level fields (background, chordChart, ccli, timeline)

This commit is contained in:
Thorsten Bus 2026-03-30 08:03:28 +02:00
parent 1f17121b24
commit e2cebe419c
2 changed files with 55 additions and 0 deletions

View file

@ -190,8 +190,15 @@ final class ProFileGenerator
$slide->setUuid(self::newUuid());
$slide->setElements($elements);
// Set slide size to 1920x1080
$slideSize = new Size();
$slideSize->setWidth(1920);
$slideSize->setHeight(1080);
$slide->setSize($slideSize);
$presentationSlide = new PresentationSlide();
$presentationSlide->setBaseSlide($slide);
$presentationSlide->setChordChart(self::buildChordChartUrl());
$slideType = new SlideType();
$slideType->setPresentation($presentationSlide);
@ -593,6 +600,12 @@ RTF);
if (isset($rootMappings[$dirSegment])) {
$root = $rootMappings[$dirSegment];
$relativePath = $matches[2];
} else {
// Unmapped user directory → ROOT_USER_HOME with user-relative path
$root = LocalRelativePath\Root::ROOT_USER_HOME;
if (preg_match('#^/Users/[^/]+/(.+)$#', $path, $userMatch)) {
$relativePath = $userMatch[1];
}
}
}

View file

@ -67,6 +67,14 @@ class ProFileGeneratorTest extends TestCase
$this->assertCount(1, $groups);
$this->assertSame('Verse 1', $groups[0]->getName());
// Verify HotKey is present on Group
$this->assertNotNull($groups[0]->getHotKey());
// Verify HotKey is present on Cue
$cues = $song->getPresentation()->getCues();
$this->assertCount(1, $cues);
$this->assertNotNull($cues[0]->getHotKey());
// Verify UUID is uppercase
$this->assertMatchesRegularExpression('/^[A-F0-9]{8}-[A-F0-9]{4}-4[A-F0-9]{3}-[89AB][A-F0-9]{3}-[A-F0-9]{12}$/', $song->getUuid());
}
@ -713,4 +721,38 @@ class ProFileGeneratorTest extends TestCase
$p = $song->getPresentation();
$this->assertNotNull($p->getCcli(), 'CCLI should be set even when empty array is passed');
}
#[Test]
public function testGenerateSlideSizeAndChordChart(): void
{
$song = ProFileGenerator::generate(
'Slide Size Test',
[
[
'name' => 'V1',
'color' => [0, 0, 0, 1],
'slides' => [
['text' => 'Test Slide'],
],
],
],
[
['name' => 'normal', 'groupNames' => ['V1']],
],
);
// Navigate to the first cue's slide action
$cue = $song->getPresentation()->getCues()[0];
$action = $cue->getActions()[0]; // slide action
$baseSlide = $action->getSlide()->getPresentation()->getBaseSlide();
// Verify slide size
$this->assertNotNull($baseSlide->getSize());
$this->assertSame(1920.0, $baseSlide->getSize()->getWidth());
$this->assertSame(1080.0, $baseSlide->getSize()->getHeight());
// Verify PresentationSlide has chordChart
$presentationSlide = $action->getSlide()->getPresentation();
$this->assertNotNull($presentationSlide->getChordChart());
}
}