protected CSSValue resolveValue(
      final DocumentContext process, final LayoutElement currentNode, final StyleKey key) {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant == false) {
      final CSSValue fallback = getFallback();
      if (fallback != null) {
        return fallback;
      }
      return null;
    }

    final CSSConstant constant = (CSSConstant) value;
    final CSSValue resolvedValue = lookupValue(constant);
    if (resolvedValue != null) {
      //      layoutContext.setValue(key, resolvedValue);
      return resolvedValue;
    }

    final CSSValue fallback = getFallback();
    if (fallback != null) {
      //      layoutContext.setValue(key, fallback);
      return fallback;
    }

    return null;
  }
  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$
    }
  }