Autofit adjustment for indent
This commit is contained in:
parent
070bc68514
commit
bb96542b64
File diff suppressed because it is too large
Load Diff
|
|
@ -229,7 +229,8 @@ class Font
|
||||||
$cellText = '',
|
$cellText = '',
|
||||||
$rotation = 0,
|
$rotation = 0,
|
||||||
?FontStyle $defaultFont = null,
|
?FontStyle $defaultFont = null,
|
||||||
bool $filterAdjustment = false
|
bool $filterAdjustment = false,
|
||||||
|
int $indentAdjustment = 0
|
||||||
): int {
|
): int {
|
||||||
// If it is rich text, use plain text
|
// If it is rich text, use plain text
|
||||||
if ($cellText instanceof RichText) {
|
if ($cellText instanceof RichText) {
|
||||||
|
|
@ -248,12 +249,12 @@ class Font
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to get the exact text width in pixels
|
// Try to get the exact text width in pixels
|
||||||
$approximate = self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX;
|
$approximate = self::$autoSizeMethod === self::AUTOSIZE_METHOD_APPROX;
|
||||||
$columnWidth = 0;
|
$columnWidth = 0;
|
||||||
if (!$approximate) {
|
if (!$approximate) {
|
||||||
$columnWidthAdjust = ceil(
|
$columnWidthAdjust = ceil(
|
||||||
self::getTextWidthPixelsExact(
|
self::getTextWidthPixelsExact(
|
||||||
str_repeat('n', 1 * ($filterAdjustment ? 3 : 1)),
|
str_repeat('n', 1 * (($filterAdjustment ? 3 : 1) + ($indentAdjustment * 2))),
|
||||||
$font,
|
$font,
|
||||||
0
|
0
|
||||||
) * 1.07
|
) * 1.07
|
||||||
|
|
@ -270,7 +271,7 @@ class Font
|
||||||
|
|
||||||
if ($approximate) {
|
if ($approximate) {
|
||||||
$columnWidthAdjust = self::getTextWidthPixelsApprox(
|
$columnWidthAdjust = self::getTextWidthPixelsApprox(
|
||||||
str_repeat('n', 1 * ($filterAdjustment ? 3 : 1)),
|
str_repeat('n', 1 * (($filterAdjustment ? 3 : 1) + ($indentAdjustment * 2))),
|
||||||
$font,
|
$font,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -756,11 +756,11 @@ class Worksheet implements IComparable
|
||||||
//By default merged cells should be ignored
|
//By default merged cells should be ignored
|
||||||
$isMergedButProceed = false;
|
$isMergedButProceed = false;
|
||||||
|
|
||||||
//The only exception is if it's a merge range value cell of a 'vertical' randge (1 column wide)
|
//The only exception is if it's a merge range value cell of a 'vertical' range (1 column wide)
|
||||||
if ($isMerged && $cell->isMergeRangeValueCell()) {
|
if ($isMerged && $cell->isMergeRangeValueCell()) {
|
||||||
$range = $cell->getMergeRange();
|
$range = $cell->getMergeRange();
|
||||||
$rangeBoundaries = Coordinate::rangeDimension($range);
|
$rangeBoundaries = Coordinate::rangeDimension($range);
|
||||||
if ($rangeBoundaries[0] == 1) {
|
if ($rangeBoundaries[0] === 1) {
|
||||||
$isMergedButProceed = true;
|
$isMergedButProceed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -774,6 +774,8 @@ class Worksheet implements IComparable
|
||||||
$filterAdjustment = true;
|
$filterAdjustment = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$indentAdjustment = $cell->getStyle()->getAlignment()->getIndent();
|
||||||
|
|
||||||
// Calculated value
|
// Calculated value
|
||||||
// To formatted string
|
// To formatted string
|
||||||
$cellValue = NumberFormat::toFormattedString(
|
$cellValue = NumberFormat::toFormattedString(
|
||||||
|
|
@ -791,7 +793,8 @@ class Worksheet implements IComparable
|
||||||
$this->getParent()->getCellXfByIndex($cell->getXfIndex())
|
$this->getParent()->getCellXfByIndex($cell->getXfIndex())
|
||||||
->getAlignment()->getTextRotation(),
|
->getAlignment()->getTextRotation(),
|
||||||
$this->getParent()->getDefaultStyle()->getFont(),
|
$this->getParent()->getDefaultStyle()->getFont(),
|
||||||
$filterAdjustment
|
$filterAdjustment,
|
||||||
|
$indentAdjustment
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -3009,7 +3012,7 @@ class Worksheet implements IComparable
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function extractSheetTitle($range, $returnRange = false)
|
public static function extractSheetTitle(string $range, $returnRange = false)
|
||||||
{
|
{
|
||||||
// Sheet title included?
|
// Sheet title included?
|
||||||
if (($sep = strrpos($range, '!')) === false) {
|
if (($sep = strrpos($range, '!')) === false) {
|
||||||
|
|
|
||||||
|
|
@ -99,4 +99,35 @@ class FontTest extends TestCase
|
||||||
$width = Font::getTextWidthPixelsApprox('n', $font, -165);
|
$width = Font::getTextWidthPixelsApprox('n', $font, -165);
|
||||||
self::assertEquals(4, $width);
|
self::assertEquals(4, $width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providerCalculateApproximateColumnWidth
|
||||||
|
*/
|
||||||
|
public function testCalculateApproximateColumnWidth(
|
||||||
|
int $expectedWidth,
|
||||||
|
StyleFont $font,
|
||||||
|
string $text,
|
||||||
|
int $rotation,
|
||||||
|
StyleFont $defaultFont,
|
||||||
|
bool $filter,
|
||||||
|
int $indent
|
||||||
|
): void {
|
||||||
|
$columnWidth = Font::calculateColumnWidth($font, $text, $rotation, $defaultFont, $filter, $indent);
|
||||||
|
self::assertEquals($expectedWidth, $columnWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function providerCalculateApproximateColumnWidth(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[13, new StyleFont(), 'Hello World', 0, new StyleFont(), false, 0],
|
||||||
|
[16, new StyleFont(), 'Hello World', 0, new StyleFont(), true, 0],
|
||||||
|
[16, new StyleFont(), 'Hello World', 0, new StyleFont(), false, 1],
|
||||||
|
[18, new StyleFont(), 'Hello World', 0, new StyleFont(), false, 2],
|
||||||
|
[20, new StyleFont(), 'Hello World', 0, new StyleFont(), false, 3],
|
||||||
|
[6, new StyleFont(), "Hello\nWorld", 0, new StyleFont(), false, 0],
|
||||||
|
[9, new StyleFont(), "Hello\nWorld", 0, new StyleFont(), true, 0],
|
||||||
|
[17, new StyleFont(), 'PhpSpreadsheet', 0, new StyleFont(), false, 0],
|
||||||
|
[19, new StyleFont(), 'PhpSpreadsheet', 0, new StyleFont(), false, 1],
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
$comment = $sheet->getComment('A1');
|
$comment = $sheet->getComment('A1');
|
||||||
|
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 178);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 178);
|
||||||
|
|
@ -127,7 +127,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment->setSizeAsBackgroundImage();
|
$comment->setSizeAsBackgroundImage();
|
||||||
self::assertEquals($comment->getWidth(), '112.5pt');
|
self::assertEquals($comment->getWidth(), '112.5pt');
|
||||||
self::assertEquals($comment->getHeight(), '112.5pt');
|
self::assertEquals($comment->getHeight(), '112.5pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_GIF);
|
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_GIF);
|
||||||
|
|
@ -144,7 +144,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment->setSizeAsBackgroundImage();
|
$comment->setSizeAsBackgroundImage();
|
||||||
self::assertEquals($comment->getWidth(), '52.5pt');
|
self::assertEquals($comment->getWidth(), '52.5pt');
|
||||||
self::assertEquals($comment->getHeight(), '52.5pt');
|
self::assertEquals($comment->getHeight(), '52.5pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_BMP);
|
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_BMP);
|
||||||
|
|
@ -162,7 +162,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment = $sheet->getComment('A1');
|
$comment = $sheet->getComment('A1');
|
||||||
self::assertEquals($comment->getWidth(), '112.5pt');
|
self::assertEquals($comment->getWidth(), '112.5pt');
|
||||||
self::assertEquals($comment->getHeight(), '112.5pt');
|
self::assertEquals($comment->getHeight(), '112.5pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 150);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 150);
|
||||||
|
|
@ -173,7 +173,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment = $sheet->getComment('A2');
|
$comment = $sheet->getComment('A2');
|
||||||
self::assertEquals($comment->getWidth(), '52.5pt');
|
self::assertEquals($comment->getWidth(), '52.5pt');
|
||||||
self::assertEquals($comment->getHeight(), '52.5pt');
|
self::assertEquals($comment->getHeight(), '52.5pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 70);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 70);
|
||||||
|
|
@ -208,7 +208,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
self::assertEquals($comment->getHeight(), '75pt');
|
self::assertEquals($comment->getHeight(), '75pt');
|
||||||
|
|
||||||
$comment = $sheet->getComment('A1');
|
$comment = $sheet->getComment('A1');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_PNG);
|
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_PNG);
|
||||||
|
|
@ -227,7 +227,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
self::assertEquals($comment->getHeight(), '112.5pt');
|
self::assertEquals($comment->getHeight(), '112.5pt');
|
||||||
|
|
||||||
$comment = $sheet->getComment('A2');
|
$comment = $sheet->getComment('A2');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_GIF);
|
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_GIF);
|
||||||
|
|
@ -246,7 +246,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
self::assertEquals($comment->getHeight(), '37.5pt');
|
self::assertEquals($comment->getHeight(), '37.5pt');
|
||||||
|
|
||||||
$comment = $sheet->getComment('A3');
|
$comment = $sheet->getComment('A3');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_JPEG);
|
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_JPEG);
|
||||||
|
|
@ -265,7 +265,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
self::assertEquals($comment->getHeight(), '52.5pt');
|
self::assertEquals($comment->getHeight(), '52.5pt');
|
||||||
|
|
||||||
$comment = $sheet->getComment('A4');
|
$comment = $sheet->getComment('A4');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_BMP);
|
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_BMP);
|
||||||
|
|
@ -284,7 +284,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
self::assertEquals($comment->getHeight(), '52.5pt');
|
self::assertEquals($comment->getHeight(), '52.5pt');
|
||||||
|
|
||||||
$comment = $sheet->getComment('A5');
|
$comment = $sheet->getComment('A5');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_BMP);
|
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_BMP);
|
||||||
|
|
@ -304,7 +304,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
self::assertEquals($comment->getHeight(), '52.5pt');
|
self::assertEquals($comment->getHeight(), '52.5pt');
|
||||||
|
|
||||||
$comment = $sheet->getComment('A6');
|
$comment = $sheet->getComment('A6');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_BMP);
|
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_BMP);
|
||||||
|
|
@ -317,7 +317,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
self::assertStringContainsString('purple_square.tiff', $drawing->getFilename());
|
self::assertStringContainsString('purple_square.tiff', $drawing->getFilename());
|
||||||
self::assertFalse($drawing->getIsUrl());
|
self::assertFalse($drawing->getIsUrl());
|
||||||
$comment = $sheet->getComment('A7');
|
$comment = $sheet->getComment('A7');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertFalse($comment->hasBackgroundImage());
|
self::assertFalse($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_UNKNOWN);
|
self::assertEquals($comment->getBackgroundImage()->getType(), IMAGETYPE_UNKNOWN);
|
||||||
|
|
@ -326,7 +326,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment->setBackgroundImage($drawing);
|
$comment->setBackgroundImage($drawing);
|
||||||
self::fail('Should throw exception when attempting to add tiff');
|
self::fail('Should throw exception when attempting to add tiff');
|
||||||
} catch (PhpSpreadsheetException $e) {
|
} catch (PhpSpreadsheetException $e) {
|
||||||
self::assertTrue($e instanceof PhpSpreadsheetException);
|
self::assertInstanceOf(PhpSpreadsheetException::class, $e);
|
||||||
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,7 +334,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$drawing->getImageTypeForSave();
|
$drawing->getImageTypeForSave();
|
||||||
self::fail('Should throw exception when attempting to get image type for tiff');
|
self::fail('Should throw exception when attempting to get image type for tiff');
|
||||||
} catch (PhpSpreadsheetException $e) {
|
} catch (PhpSpreadsheetException $e) {
|
||||||
self::assertTrue($e instanceof PhpSpreadsheetException);
|
self::assertInstanceOf(PhpSpreadsheetException::class, $e);
|
||||||
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,7 +342,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$drawing->getMediaFilename();
|
$drawing->getMediaFilename();
|
||||||
self::fail('Should throw exception when attempting to get media file name for tiff');
|
self::fail('Should throw exception when attempting to get media file name for tiff');
|
||||||
} catch (PhpSpreadsheetException $e) {
|
} catch (PhpSpreadsheetException $e) {
|
||||||
self::assertTrue($e instanceof PhpSpreadsheetException);
|
self::assertInstanceOf(PhpSpreadsheetException::class, $e);
|
||||||
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -350,7 +350,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$drawing->getImageFileExtensionForSave();
|
$drawing->getImageFileExtensionForSave();
|
||||||
self::fail('Should throw exception when attempting to get image file extention for tiff');
|
self::fail('Should throw exception when attempting to get image file extention for tiff');
|
||||||
} catch (PhpSpreadsheetException $e) {
|
} catch (PhpSpreadsheetException $e) {
|
||||||
self::assertTrue($e instanceof PhpSpreadsheetException);
|
self::assertInstanceOf(PhpSpreadsheetException::class, $e);
|
||||||
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -358,7 +358,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$drawing->getImageMimeType();
|
$drawing->getImageMimeType();
|
||||||
self::fail('Should throw exception when attempting to get image mime type for tiff');
|
self::fail('Should throw exception when attempting to get image mime type for tiff');
|
||||||
} catch (PhpSpreadsheetException $e) {
|
} catch (PhpSpreadsheetException $e) {
|
||||||
self::assertTrue($e instanceof PhpSpreadsheetException);
|
self::assertInstanceOf(PhpSpreadsheetException::class, $e);
|
||||||
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
self::assertEquals($e->getMessage(), 'Unsupported image type in comment background. Supported types: PNG, JPEG, BMP, GIF.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -375,7 +375,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment = $sheet->getComment('A1');
|
$comment = $sheet->getComment('A1');
|
||||||
self::assertEquals($comment->getWidth(), '75pt');
|
self::assertEquals($comment->getWidth(), '75pt');
|
||||||
self::assertEquals($comment->getHeight(), '75pt');
|
self::assertEquals($comment->getHeight(), '75pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 100);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 100);
|
||||||
|
|
@ -386,7 +386,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment = $sheet->getComment('A2');
|
$comment = $sheet->getComment('A2');
|
||||||
self::assertEquals($comment->getWidth(), '112.5pt');
|
self::assertEquals($comment->getWidth(), '112.5pt');
|
||||||
self::assertEquals($comment->getHeight(), '112.5pt');
|
self::assertEquals($comment->getHeight(), '112.5pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 150);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 150);
|
||||||
|
|
@ -397,7 +397,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment = $sheet->getComment('A3');
|
$comment = $sheet->getComment('A3');
|
||||||
self::assertEquals($comment->getWidth(), '37.5pt');
|
self::assertEquals($comment->getWidth(), '37.5pt');
|
||||||
self::assertEquals($comment->getHeight(), '37.5pt');
|
self::assertEquals($comment->getHeight(), '37.5pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 50);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 50);
|
||||||
|
|
@ -408,7 +408,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment = $sheet->getComment('A4');
|
$comment = $sheet->getComment('A4');
|
||||||
self::assertEquals($comment->getWidth(), '52.5pt');
|
self::assertEquals($comment->getWidth(), '52.5pt');
|
||||||
self::assertEquals($comment->getHeight(), '52.5pt');
|
self::assertEquals($comment->getHeight(), '52.5pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 70);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 70);
|
||||||
|
|
@ -419,7 +419,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment = $sheet->getComment('A5');
|
$comment = $sheet->getComment('A5');
|
||||||
self::assertEquals($comment->getWidth(), '52.5pt');
|
self::assertEquals($comment->getWidth(), '52.5pt');
|
||||||
self::assertEquals($comment->getHeight(), '52.5pt');
|
self::assertEquals($comment->getHeight(), '52.5pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 70);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 70);
|
||||||
|
|
@ -430,7 +430,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
$comment = $sheet->getComment('A6');
|
$comment = $sheet->getComment('A6');
|
||||||
self::assertEquals($comment->getWidth(), '52.5pt');
|
self::assertEquals($comment->getWidth(), '52.5pt');
|
||||||
self::assertEquals($comment->getHeight(), '52.5pt');
|
self::assertEquals($comment->getHeight(), '52.5pt');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertTrue($comment->hasBackgroundImage());
|
self::assertTrue($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 70);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 70);
|
||||||
|
|
@ -439,7 +439,7 @@ class DrawingsTest extends AbstractFunctional
|
||||||
|
|
||||||
// Check seventh image in comment background
|
// Check seventh image in comment background
|
||||||
$comment = $sheet->getComment('A7');
|
$comment = $sheet->getComment('A7');
|
||||||
self::assertTrue($comment instanceof Comment);
|
self::assertInstanceOf(Comment::class, $comment);
|
||||||
self::assertFalse($comment->hasBackgroundImage());
|
self::assertFalse($comment->hasBackgroundImage());
|
||||||
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
self::assertTrue($comment->getBackgroundImage() instanceof Drawing);
|
||||||
self::assertEquals($comment->getBackgroundImage()->getWidth(), 0);
|
self::assertEquals($comment->getBackgroundImage()->getWidth(), 0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue