refactor(pro): set visual attributes to enable=false

This commit is contained in:
Thorsten Bus 2026-03-02 21:24:03 +01:00
parent 02b080a75d
commit e7c014abfe
2 changed files with 56 additions and 5 deletions

View file

@ -333,7 +333,7 @@ final class ProFileGenerator
private static function buildFill(): Fill
{
$fill = new Fill();
$fill->setEnable(true);
$fill->setEnable(false);
$fill->setColor(self::buildColor(0.13, 0.59, 0.95, 1.0));
return $fill;
@ -343,7 +343,7 @@ final class ProFileGenerator
{
$stroke = new Stroke();
$stroke->setStyle(StrokeStyle::STYLE_SOLID_LINE);
$stroke->setEnable(true);
$stroke->setEnable(false);
$stroke->setWidth(3.0);
$stroke->setColor(self::buildColor(1.0, 1.0, 1.0, 1.0));
@ -354,7 +354,7 @@ final class ProFileGenerator
{
$shadow = new Shadow();
$shadow->setStyle(ShadowStyle::STYLE_DROP);
$shadow->setEnable(true);
$shadow->setEnable(false);
$shadow->setAngle(315.0);
$shadow->setOffset(5.0);
$shadow->setRadius(5.0);
@ -368,7 +368,7 @@ final class ProFileGenerator
{
$feather = new Feather();
$feather->setStyle(FeatherStyle::STYLE_INSIDE);
$feather->setEnable(true);
$feather->setEnable(false);
$feather->setRadius(0.05);
return $feather;
@ -377,7 +377,7 @@ final class ProFileGenerator
private static function buildTextScroller(): TextScroller
{
$textScroller = new TextScroller();
$textScroller->setShouldScroll(true);
$textScroller->setShouldScroll(false);
$textScroller->setScrollRate(0.5);
$textScroller->setShouldRepeat(true);
$textScroller->setRepeatDistance(0.0617);

View file

@ -415,4 +415,55 @@ class ProFileGeneratorTest extends TestCase
$this->assertSame('Image Macro', $slide->getMacroName());
$this->assertSame('AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE', $slide->getMacroUuid());
}
#[Test]
public function testGenerateAttributesAreDisabled(): void
{
$song = ProFileGenerator::generate(
'Attributes Test',
[
[
'name' => 'Verse 1',
'color' => [0.1, 0.2, 0.3, 1.0],
'slides' => [
['text' => 'Test Text'],
],
],
],
[
['name' => 'normal', 'groupNames' => ['Verse 1']],
],
);
$slide = $song->getSlides()[0];
$elements = $slide->getAllElements();
$this->assertCount(1, $elements);
$element = $elements[0];
$graphicsElement = $element->getGraphicsElement();
// Verify fill is present but disabled
$this->assertNotNull($graphicsElement->getFill());
$this->assertFalse($graphicsElement->getFill()->getEnable());
// Verify stroke is present but disabled
$this->assertNotNull($graphicsElement->getStroke());
$this->assertFalse($graphicsElement->getStroke()->getEnable());
// Verify shadow is present but disabled
$this->assertNotNull($graphicsElement->getShadow());
$this->assertFalse($graphicsElement->getShadow()->getEnable());
// Verify feather is present but disabled
$this->assertNotNull($graphicsElement->getFeather());
$this->assertFalse($graphicsElement->getFeather()->getEnable());
// Verify text scroller is present but disabled (should_scroll = false)
// Access the raw SlideElement protobuf to get TextScroller
$slideElements = $slide->getCue()->getActions()[0]->getSlide()->getPresentation()->getBaseSlide()->getElements();
$this->assertCount(1, $slideElements);
$textScroller = $slideElements[0]->getTextScroller();
$this->assertNotNull($textScroller);
$this->assertFalse($textScroller->getShouldScroll());
}
}