-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PowerPoint2007 Writer : Support for Area Chart - @Progi1984 GH-82
- Loading branch information
Showing
6 changed files
with
259 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ vendor | |
/samples/#47 | ||
/samples/#70 | ||
/samples/#71 | ||
/samples/Github_*.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPowerPoint - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPowerPoint is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPowerPoint/contributors. | ||
* | ||
* @copyright 2009-2014 PHPPowerPoint contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
* @link https://github.com/PHPOffice/PHPPowerPoint | ||
*/ | ||
|
||
namespace PhpOffice\PhpPowerpoint\Tests\Writer\PowerPoint2007; | ||
|
||
use PhpOffice\PhpPowerpoint\PhpPowerpoint; | ||
use PhpOffice\PhpPowerpoint\Shape\Chart\Series; | ||
use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; | ||
use PhpOffice\PhpPowerpoint\Style\Color; | ||
use PhpOffice\PhpPowerpoint\Style\Fill; | ||
use PhpOffice\PhpPowerpoint\Tests\TestHelperDOCX; | ||
use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; | ||
use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Chart; | ||
|
||
/** | ||
* Test class for PowerPoint2007 | ||
* | ||
* @coversDefaultClass PowerPoint2007 | ||
*/ | ||
class ChartAreaTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Executed before each method of the class | ||
*/ | ||
public function tearDown() | ||
{ | ||
TestHelperDOCX::clear(); | ||
} | ||
|
||
public function testTypeArea() | ||
{ | ||
$seriesData = array( | ||
'A' => 1, | ||
'B' => 2, | ||
'C' => 4, | ||
'D' => 3, | ||
'E' => 2, | ||
); | ||
|
||
$oPHPPowerPoint = new PhpPowerpoint(); | ||
$oSlide = $oPHPPowerPoint->getActiveSlide(); | ||
$oShape = $oSlide->createChartShape(); | ||
$oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); | ||
$oArea = new Area(); | ||
$oSeries = new Series('Downloads', $seriesData); | ||
$oSeries->getFill()->setStartColor(new Color('FFAABBCC')); | ||
$oArea->addSeries($oSeries); | ||
$oShape->getPlotArea()->setType($oArea); | ||
|
||
$oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); | ||
|
||
$element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; | ||
$this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); | ||
$element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart'; | ||
$this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); | ||
$element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser'; | ||
$this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); | ||
$element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:dPt/c:spPr'; | ||
$this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); | ||
$element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:tx/c:v'; | ||
$this->assertEquals($oSeries->getTitle(), $oXMLDoc->getElement($element, 'ppt/charts/'.$oShape->getIndexedFilename())->nodeValue); | ||
} | ||
} |