PhpSpreadsheet/tests/PhpSpreadsheetTests/Style
oleibman 67bf45d700
Fill Pattern Start and End Colors (#2444)
* Fill Pattern Start and End Colors

Fix #2441. The Fill constructor sets start color to white and end color to black and the Xlsx writer writes these values to the output file. This appears to be the wrong setting for all 7 LIGHT* pattern types, 2 of the 7 DARK* patterns (DARKGRAY and DARKTRELLIS), and 1 of the 3 GRAY patterns (GRAY0625). When the wrong colors are written at save time, those patterns are not as expected. Xls writer does not appear to have the same problem.

The XML does not require either a start or end color, and the omission of these colors in the file being read was responsible for the problem. The code is changed to mimic that behavior by omitting the color tags at write time if they have not changed from when they were created by the Fill constructor (they will be written for gradient or solid patterns regardless).

This is another change which is easier to confirm via samples rather than tests. There are separate samples for Xlsx and Xls; as Excel will be quick to warn you, Xls is not as fully functional as Xlsx with respect to fill patterns. The samples do include a cell where one of the cells (LightGrid in C11) explicitly specifies the "default" colors.

* Scrutinizer

It somehow ascribed to me a problem in code which was unchanged by this PR. Correct it anyhow, along with some Phpstan fixes (errors now ignored because of change).

* Added Tests

Also corrected some docBlock problems with Style/*/parent and getSharedComponent.

* Create 2 Abstract Methods

Scrutinizer complained that 2 methods found in all Supervisor sub-types were not defined in Supervisor. Add abstract methods to satisfy it.

* Scrutinizer Ignoring Typehints

Try this instead.

* Slight Improvement

Better handling of Style->getParent().
2021-12-18 08:53:23 -08:00
..
AlignmentTest.php Add exportArray Method for Styles (#1580) 2020-10-26 20:56:24 +01:00
BorderRangeTest.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
BorderTest.php Add exportArray Method for Styles (#1580) 2020-10-26 20:56:24 +01:00
ColorTest.php Merge branch 'master' into PHP8-Sane-Property-Names 2021-10-31 15:25:01 +09:00
ConditionalTest.php Add exportArray Method for Styles (#1580) 2020-10-26 20:56:24 +01:00
ExportArrayTest.php Fill Pattern Start and End Colors (#2444) 2021-12-18 08:53:23 -08:00
FillTest.php Add exportArray Method for Styles (#1580) 2020-10-26 20:56:24 +01:00
FontTest.php fix: Set font size to 10 when given 0 2021-05-29 11:17:25 +02:00
NumberFormatBuiltinTest.php Add exportArray Method for Styles (#1580) 2020-10-26 20:56:24 +01:00
NumberFormatRoundTest.php Rounding in NumberFormatter (#2399) 2021-11-26 09:05:35 -08:00
NumberFormatTest.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
StyleTest.php Optimize applyFromArray by caching existing styles (#1785) 2021-10-31 00:55:00 +09:00