2 * SonarQube, open source software quality management tool.
3 * Copyright (C) 2008-2014 SonarSource
4 * mailto:contact AT sonarsource DOT com
6 * SonarQube is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * SonarQube is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.plugins.core.charts;
22 import org.junit.Test;
23 import org.sonar.api.charts.AbstractChartTest;
24 import org.sonar.api.charts.ChartParameters;
26 import java.awt.image.BufferedImage;
27 import java.io.IOException;
29 public class DistributionAreaChartTest extends AbstractChartTest {
32 public void oneSerie() throws IOException {
33 DistributionAreaChart chart = new DistributionAreaChart();
34 BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2"));
35 assertChartSizeGreaterThan(image, 1000);
36 saveChart(image, "DistributionAreaChartTest/oneSerie.png");
40 public void manySeries() throws IOException {
41 DistributionAreaChart chart = new DistributionAreaChart();
42 BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|0%3D7%3B1%3D15%3B2%3D4"));
43 assertChartSizeGreaterThan(image, 1000);
44 saveChart(image, "DistributionAreaChartTest/manySeries.png");
48 public void manySeriesWithDifferentCategories() throws IOException {
49 DistributionAreaChart chart = new DistributionAreaChart();
50 BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2|2%3D7%3B4%3D15%3B9%3D4"));
51 assertChartSizeGreaterThan(image, 1000);
52 saveChart(image, "DistributionAreaChartTest/manySeriesWithDifferentCategories.png");
56 public void manySeriesIncludingAnEmptySerie() throws IOException {
57 // the third serie should not have the second default color, but the third one !
58 DistributionAreaChart chart = new DistributionAreaChart();
59 BufferedImage image = chart.generateImage(new ChartParameters("v=0%3D5%3B1%3D22%3B2%3D2||2%3D7%3B4%3D15%3B9%3D4"));
60 assertChartSizeGreaterThan(image, 1000);
61 saveChart(image, "DistributionAreaChartTest/manySeriesIncludingAnEmptySerie.png");