public void testPieExplodePercentStyle() throws Exception {
    final ChartDocumentContext cdc =
        ChartFactory.generateChart(
            getClass().getResource("PieExplodePercentStyleTest.xml")); // $NON-NLS-1$
    final ChartDocument cd = cdc.getChartDocument();
    assertNotNull(cd);
    final ChartElement element = cd.getRootElement();
    assertNotNull(element);

    final CSSNumericValue[] passValues =
        new CSSNumericValue[] {
          CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 0), // $NON-NLS-1$
          CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 100), // $NON-NLS-1$
          CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 75), // $NON-NLS-1$
          CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 5), // $NON-NLS-1$
          CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 0), // $NON-NLS-1$
          CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 0), // $NON-NLS-1$
        };

    int counter = 0;
    final int lenArray = passValues.length;
    ChartElement child = element.getFirstChildItem();

    while (child != null) {
      final LayoutStyle layoutStyle = child.getLayoutStyle();
      assertNotNull(layoutStyle);
      System.out.println(
          "Expected: "
              + passValues[counter]
              + " - Got: "
              + layoutStyle.getValue(
                  ChartStyleKeys.PIE_EXPLODE_PERCENT)); // $NON-NLS-1$ //$NON-NLS-2$
      assertEquals(
          passValues[counter++].getCSSText(),
          layoutStyle.getValue(ChartStyleKeys.PIE_EXPLODE_PERCENT).getCSSText());
      child = child.getNextItem();
    }

    if (counter < lenArray - 1) {
      throw new IllegalStateException("Not all tests covered!"); // $NON-NLS-1$
    }
  }
  public void testLineVisible() throws IllegalStateException, ResourceException {
    final ChartDocumentContext cdc =
        ChartFactory.generateChart(
            getClass().getResource("ChartLineVisibleTest.xml")); // $NON-NLS-1$
    final ChartDocument cd = cdc.getChartDocument();
    assertNotNull(cd);
    final ChartElement element = cd.getRootElement();
    assertNotNull(element);

    final CSSConstant[] passValues =
        new CSSConstant[] {
          ChartLineVisibleType.VISIBLE,
          ChartLineVisibleType.VISIBLE,
          ChartLineVisibleType.HIDDEN,
          ChartLineVisibleType.VISIBLE,
          ChartLineVisibleType.VISIBLE,
          ChartLineVisibleType.VISIBLE,
        };

    int counter = 0;
    final int lenArray = passValues.length;
    ChartElement child = element.getFirstChildItem();

    while (child != null) {
      final LayoutStyle layoutStyle = child.getLayoutStyle();
      assertNotNull(layoutStyle);
      System.out.println(
          "Expected: "
              + passValues[counter]
              + " - Got: "
              + layoutStyle.getValue(ChartStyleKeys.LINE_VISIBLE)); // $NON-NLS-1$ //$NON-NLS-2$
      assertEquals(passValues[counter++], layoutStyle.getValue(ChartStyleKeys.LINE_VISIBLE));
      child = child.getNextItem();
    }

    if (counter < lenArray - 1) {
      throw new IllegalStateException("Not all tests covered!"); // $NON-NLS-1$
    }
  }
 /** Very ugly but there is no stinking XPath support. */
 protected ChartElement[] getElements(ChartDocument doc, String name) {
   if (ChartElement.TAG_NAME_PLOT.equals(name)) {
     return new ChartElement[] {doc.getPlotElement()};
   } else if (DIALRANGE.equals(name)) {
     ChartElement plotElem = doc.getPlotElement();
     if (plotElem != null) {
       ChartElement[] dialRanges = plotElem.findChildrenByName(DIALRANGES);
       if (dialRanges.length > 0) {
         return dialRanges[0].findChildrenByName(name);
       } else {
         return null;
       }
     } else {
       return null;
     }
   } else if (TICKLABEL.equals(name) || MAJORTICK.equals(name) || MINORTICK.equals(name)) {
     return doc.getPlotElement().findChildrenByName(SCALE)[0].findChildrenByName(name);
   } else {
     ChartElement[] elems = doc.getPlotElement().findChildrenByName(name);
     return elems;
   }
 }