From e7c014abfe8b7cfa29b6a442b2a6e2d94bf3ddd0 Mon Sep 17 00:00:00 2001 From: Thorsten Bus Date: Mon, 2 Mar 2026 21:24:03 +0100 Subject: [PATCH] refactor(pro): set visual attributes to enable=false --- php/src/ProFileGenerator.php | 10 +++--- php/tests/ProFileGeneratorTest.php | 51 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/php/src/ProFileGenerator.php b/php/src/ProFileGenerator.php index d248d61..338351d 100644 --- a/php/src/ProFileGenerator.php +++ b/php/src/ProFileGenerator.php @@ -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); diff --git a/php/tests/ProFileGeneratorTest.php b/php/tests/ProFileGeneratorTest.php index bdc6afe..f703ea1 100644 --- a/php/tests/ProFileGeneratorTest.php +++ b/php/tests/ProFileGeneratorTest.php @@ -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()); + } }