tempDir = $this->createTempDir( __CLASS__ . sprintf( '_%03d_', ++$i ) ) . '/'; $this->basePath = dirname( __FILE__ ) . '/data/'; } /** * tearDown * * @access public */ public function tearDown() { $this->removeTempDir(); } public function testRenderLabeledPieSegment() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); $chart['sample'] = array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987, ); $chart['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRenderLabeledPieSegmentPolygonOrder() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); $chart['sample'] = array( 'label 1' => 20, 'label 2' => 20, 'label 3' => 20, 'label 4' => 20, 'label 5' => 20, 'label 6' => 20, 'label 7' => 20, 'label 8' => 20, 'label 9' => 20, 'label 10' => 20, ); $chart['sample']->highlight = true; $chart->options->label = '%1$s'; $chart->legend = false; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->moveOut = .3; $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRenderLabeledPieSegmentWithoutSymbols() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); $chart['sample'] = array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987, ); $chart['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->showSymbol = false; $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRenderLabeledPieSegmentWithIncreasedMoveOut() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); $chart['sample'] = array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987, ); $chart['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->moveOut = .2; $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRenderLabeledPieSegmentWithoutDataBorder() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); $chart['sample'] = array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987, ); $chart['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->dataBorder = 0; $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRenderLabeledPieSegmentWithCustomHeight() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); $chart['sample'] = array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987, ); $chart['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->pieChartHeight = 5; $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRenderLabeledPieSegmentWithCustomRotation() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphPieChart(); $chart['sample'] = array( 'Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987, ); $chart['sample']->highlight['Safari'] = true; $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->pieChartRotation = .3; $chart->driver = new ezcGraphGdDriver(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRender3dLineChart() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRender3dFilledLineChart() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); $chart->options->fillLines = 200; $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRender3dFilledLineChartWithAxisIntersection() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); $chart->options->fillLines = 200; $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => -151, 'sample 3' => 324, 'sample 4' => -120, 'sample 5' => 1); $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => -5, 'sample 5' => -124); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRender3dFilledLineChartWithoutDataBorder() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->dataBorder = 0; $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRender3dFilledLineChartNonFilledGrid() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->fillGrid = 1; $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } public function testRender3dFilledLineChartNonFilledAxis() { $filename = $this->tempDir . __FUNCTION__ . '.png'; $chart = new ezcGraphLineChart(); $chart->palette = new ezcGraphPaletteBlack(); $chart['Line 1'] = array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1); $chart['Line 2'] = array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613); $chart->driver = new ezcGraphGdDriver(); $chart->renderer = new ezcGraphRenderer3d(); $chart->renderer->options->fillAxis = 1; $chart->options->font = $this->basePath . 'font.ttf'; $chart->render( 500, 200, $filename ); $this->assertImageSimilar( $filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 10 ); } } ?>