PhpPresentation\Tests\Writer\PowerPoint2007\PptChartsTest::testTypeLineGridlines PHP Method

testTypeLineGridlines() public method

    public function testTypeLineGridlines()
    {
        $arrayTests = array(array('methodAxis' => 'getAxisX', 'methodGrid' => 'setMajorGridlines', 'expectedElement' => '/c:chartSpace/c:chart/c:plotArea/c:catAx/c:majorGridlines/c:spPr/a:ln', 'expectedElementColor' => '/c:chartSpace/c:chart/c:plotArea/c:catAx/c:majorGridlines/c:spPr/a:ln/a:solidFill/a:srgbClr'), array('methodAxis' => 'getAxisX', 'methodGrid' => 'setMinorGridlines', 'expectedElement' => '/c:chartSpace/c:chart/c:plotArea/c:catAx/c:minorGridlines/c:spPr/a:ln', 'expectedElementColor' => '/c:chartSpace/c:chart/c:plotArea/c:catAx/c:minorGridlines/c:spPr/a:ln/a:solidFill/a:srgbClr'), array('methodAxis' => 'getAxisY', 'methodGrid' => 'setMajorGridlines', 'expectedElement' => '/c:chartSpace/c:chart/c:plotArea/c:valAx/c:majorGridlines/c:spPr/a:ln', 'expectedElementColor' => '/c:chartSpace/c:chart/c:plotArea/c:valAx/c:majorGridlines/c:spPr/a:ln/a:solidFill/a:srgbClr'), array('methodAxis' => 'getAxisY', 'methodGrid' => 'setMinorGridlines', 'expectedElement' => '/c:chartSpace/c:chart/c:plotArea/c:valAx/c:minorGridlines/c:spPr/a:ln', 'expectedElementColor' => '/c:chartSpace/c:chart/c:plotArea/c:valAx/c:minorGridlines/c:spPr/a:ln/a:solidFill/a:srgbClr'));
        $expectedColor = new Color(Color::COLOR_BLUE);
        foreach ($arrayTests as $arrayTest) {
            $expectedSizePts = rand(1, 100);
            $expectedSizeEmu = round(Drawing::pointsToPixels(Drawing::pixelsToEmu($expectedSizePts)));
            $oPresentation = new PhpPresentation();
            $oSlide = $oPresentation->getActiveSlide();
            $oShape = $oSlide->createChartShape();
            $oLine = new Line();
            $oLine->addSeries(new Series('Downloads', array('A' => 1, 'B' => 2, 'C' => 4, 'D' => 3, 'E' => 2)));
            $oShape->getPlotArea()->setType($oLine);
            $oGridlines = new Gridlines();
            $oGridlines->getOutline()->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor($expectedColor);
            $oGridlines->getOutline()->setWidth($expectedSizePts);
            $oShape->getPlotArea()->{$arrayTest['methodAxis']}()->{$arrayTest['methodGrid']}($oGridlines);
            $oXMLDoc = TestHelperDOCX::getDocument($oPresentation, 'PowerPoint2007');
            $this->assertTrue($oXMLDoc->fileExists('ppt/charts/' . $oShape->getIndexedFilename()));
            $this->assertTrue($oXMLDoc->elementExists($arrayTest['expectedElement'], 'ppt/charts/' . $oShape->getIndexedFilename()));
            $this->assertTrue($oXMLDoc->attributeElementExists($arrayTest['expectedElement'], 'w', 'ppt/charts/' . $oShape->getIndexedFilename()));
            $this->assertEquals($expectedSizeEmu, $oXMLDoc->getElementAttribute($arrayTest['expectedElement'], 'w', 'ppt/charts/' . $oShape->getIndexedFilename()));
            $this->assertTrue($oXMLDoc->elementExists($arrayTest['expectedElementColor'], 'ppt/charts/' . $oShape->getIndexedFilename()));
            $this->assertTrue($oXMLDoc->attributeElementExists($arrayTest['expectedElementColor'], 'val', 'ppt/charts/' . $oShape->getIndexedFilename()));
            $this->assertEquals($expectedColor->getRGB(), $oXMLDoc->getElementAttribute($arrayTest['expectedElementColor'], 'val', 'ppt/charts/' . $oShape->getIndexedFilename()));
            unset($oPresentation);
            TestHelperDOCX::clear();
        }
    }