Skip to content

Commit

Permalink
Merge pull request PHPOffice#334 from Progi1984/issue265
Browse files Browse the repository at this point in the history
PHPOffice#265 : Added two methods for setting Border & Fill in Legend
  • Loading branch information
Progi1984 authored Mar 3, 2017
2 parents 4eae228 + bf4d7e3 commit 89b566d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- ODPresentation Writer : Axis Bounds in Chart - @Progi1984 GH-269
- PowerPoint2007 Writer : Implement character spacing - @jvanoostrom GH-301
- PowerPoint2007 Writer : Axis Bounds in Chart - @Progi1984 GH-269
- Misc : Added two methods for setting Border & Fill in Legend - @Progi1984 GH-265

## 0.7.0 - 2016-09-12

Expand Down
24 changes: 24 additions & 0 deletions src/PhpPresentation/Shape/Chart/Legend.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,18 @@ public function getBorder()
return $this->border;
}

/**
* Set Border
*
* @param \PhpOffice\PhpPresentation\Style\Border $border
* @return \PhpOffice\PhpPresentation\Shape\RichText\Paragraph
*/
public function setBorder(Border $border)
{
$this->border = $border;
return $this;
}

/**
* Get Fill
*
Expand All @@ -291,6 +303,18 @@ public function getFill()
return $this->fill;
}

/**
* Set Fill
*
* @param \PhpOffice\PhpPresentation\Style\Fill $fill
* @return \PhpOffice\PhpPresentation\Shape\RichText\Paragraph
*/
public function setFill(Fill $fill)
{
$this->fill = $fill;
return $this;
}

/**
* Get alignment
*
Expand Down
18 changes: 18 additions & 0 deletions tests/PhpPresentation/Tests/Shape/Chart/LegendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ public function testAlignment()
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment());
}

public function testBorder()
{
$object = new Legend();

$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder());
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setBorder(new Border()));
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder());
}

public function testFill()
{
$object = new Legend();

$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill());
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFill(new Fill()));
$this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill());
}

public function testFont()
{
$object = new Legend();
Expand Down

0 comments on commit 89b566d

Please sign in to comment.