Skip to content

Commit c3fb5cc

Browse files
committed
fix minor test issues
1 parent 24238bb commit c3fb5cc

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Or add to your `composer.json`:
166166
```json
167167
{
168168
"require": {
169-
"tecnickcom/tc-lib-pdf": "^8.6"
169+
"tecnickcom/tc-lib-pdf": "^8"
170170
}
171171
}
172172
```

src/SVG.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,10 @@ protected function getSVGPath(
11871187
$coord['firstcmd'] = false;
11881188
}
11891189

1190+
if (empty($out)) {
1191+
return '';
1192+
}
1193+
11901194
$this->bbox[] = [
11911195
'x' => $coord['xmin'],
11921196
'y' => $coord['ymin'],

test/OutputTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -687,12 +687,15 @@ public function testPatternStreamResourcesParseGradientAndImageDoTokens(): void
687687
$outfont = new \Com\Tecnick\Pdf\Font\Output($font->getFonts(), $pon, $encrypt);
688688
$this->setObjectProperty($obj, 'outfont', $outfont);
689689

690-
// Register a gradient shader to ensure gradient resources are available.
691-
$graph->getAlpha(0.8);
692-
$graph->getStopTransform();
690+
$graph->getLinearGradient(0.0, 0.0, 10.0, 10.0, 'red', 'blue');
691+
$graph->getOutGradientShaders($pon);
692+
$gradientId = $graph->getLastGradientID();
693693

694-
$out = $obj->exposeGetPatternStreamResourceDict('/Sh9 sh /I2 Do');
694+
$this->assertNotNull($gradientId);
695695

696+
$out = $obj->exposeGetPatternStreamResourceDict('/Sh' . $gradientId . ' sh /I2 Do');
697+
698+
$this->assertStringContainsString(' /Pattern <<', $out);
696699
$this->assertStringContainsString(' /XObject <<', $out);
697700
}
698701

@@ -3871,7 +3874,7 @@ public function testGetOutEmbeddedFilesSkipsUnreadableSourceFiles(): void
38713874
$throwingFile = new class () extends \Com\Tecnick\File\File {
38723875
public function fileGetContents(string $path): string
38733876
{
3874-
throw new \Com\Tecnick\Pdf\Exception('mock unreadable file');
3877+
throw new \Com\Tecnick\Pdf\Exception('mock unreadable file: ' . $path);
38753878
}
38763879
};
38773880
$this->setObjectProperty($obj, 'file', $throwingFile);

0 commit comments

Comments
 (0)