Search in sources :

Example 1 with NonBlockingStringReader

use of com.helger.commons.io.stream.NonBlockingStringReader in project ph-css by phax.

the class ParserCSS30Test method test2.

@Test
public void test2() throws ParseException {
    final ParserCSS30TokenManager aTokenHdl = new ParserCSS30TokenManager(new CSSCharStream(new NonBlockingStringReader(CSS2)));
    aTokenHdl.setDebugStream(System.out);
    final ParserCSS30 aParser = new ParserCSS30(aTokenHdl);
    aParser.disable_tracing();
    final CSSNode aNode = aParser.styleSheet();
    assertNotNull(aNode);
    final CascadingStyleSheet aCSS = CSSHandler.readCascadingStyleSheetFromNode(ECSSVersion.CSS30, aNode, CSSReader.getDefaultInterpretErrorHandler());
    assertNotNull(aCSS);
    for (final ICSSTopLevelRule aTopLevelRule : aCSS.getAllFontFaceRules()) assertTrue(aCSS.removeRule(aTopLevelRule).isChanged());
}
Also used : CascadingStyleSheet(com.helger.css.decl.CascadingStyleSheet) ICSSTopLevelRule(com.helger.css.decl.ICSSTopLevelRule) NonBlockingStringReader(com.helger.commons.io.stream.NonBlockingStringReader) Test(org.junit.Test)

Aggregations

NonBlockingStringReader (com.helger.commons.io.stream.NonBlockingStringReader)1 CascadingStyleSheet (com.helger.css.decl.CascadingStyleSheet)1 ICSSTopLevelRule (com.helger.css.decl.ICSSTopLevelRule)1 Test (org.junit.Test)1