1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package test.javafx.scene.chart;
  27 
  28 import java.lang.reflect.InvocationTargetException;
  29 import java.util.Arrays;
  30 import java.util.Collection;
  31 import javafx.scene.chart.AreaChart;
  32 import javafx.scene.chart.Axis;
  33 import javafx.scene.chart.BubbleChart;
  34 import javafx.scene.chart.Chart;
  35 import javafx.scene.chart.LineChart;
  36 import javafx.scene.chart.NumberAxis;
  37 import javafx.scene.chart.ScatterChart;
  38 import javafx.scene.chart.StackedAreaChart;
  39 import javafx.scene.chart.XYChart;
  40 import org.junit.Test;
  41 import org.junit.runner.RunWith;
  42 import org.junit.runners.Parameterized;
  43 
  44 @RunWith(Parameterized.class)
  45 public class XYNumberChartsTest extends XYNumberChartsTestBase {
  46     private Class chartClass;
  47     int nodesPerSeries;
  48 
  49     @Parameterized.Parameters
  50     public static Collection implementations() {
  51         return Arrays.asList(new Object[][] {
  52             { AreaChart.class, 1, },
  53             { BubbleChart.class, 0, },
  54             { LineChart.class, 1, },
  55             { ScatterChart.class, 0, },
  56             { StackedAreaChart.class, 1, },
  57         });
  58     }
  59 
  60     public XYNumberChartsTest(Class chartClass, int nodesPerSeries) {
  61         this.chartClass = chartClass;
  62         this.nodesPerSeries = nodesPerSeries;
  63     }
  64 
  65     @Override
  66     protected Chart createChart() {
  67         try {
  68             chart = (XYChart<Number, Number>) chartClass.getConstructor(Axis.class, Axis.class).
  69                 newInstance(new NumberAxis(), new NumberAxis());
  70         } catch (InvocationTargetException e) {
  71             throw new AssertionError(e.getCause());
  72         } catch (Exception e) {
  73             throw new AssertionError(e);
  74         }
  75         return chart;
  76     }
  77 
  78     @Test
  79     public void testSeriesClearAnimated_rt_40632() {
  80         checkSeriesClearAnimated_rt_40632();
  81     }
  82 
  83     @Test
  84     public void testSeriesRemove() {
  85         checkSeriesRemove(2 + nodesPerSeries);
  86     }
  87 
  88     @Override
  89     void checkSeriesStyleClasses(XYChart.Series<?, ?> series, int seriesIndex, int colorIndex) {
  90         throw new UnsupportedOperationException("Not supported yet.");
  91     }
  92 
  93     @Override
  94     void checkDataStyleClasses(XYChart.Data<?, ?> data, int seriesIndex, int dataIndex, int colorIndex) {
  95         throw new UnsupportedOperationException("Not supported yet.");
  96     }
  97 }