Search in sources :

Example 36 with IReadableResource

use of com.helger.commons.io.resource.IReadableResource in project ph-css by phax.

the class Issue8Test method testIssue8.

@Test
public void testIssue8() {
    final IReadableResource aRes = new ClassPathResource("testfiles/css30/good/issue8.css");
    assertTrue(aRes.exists());
    final CascadingStyleSheet aCSS = CSSReader.readFromStream(aRes, StandardCharsets.UTF_8, ECSSVersion.CSS30, new LoggingCSSParseErrorHandler());
    assertNotNull(aCSS);
    assertEquals(1, aCSS.getStyleRuleCount());
    final CSSStyleRule aStyleRule = aCSS.getStyleRuleAtIndex(0);
    assertNotNull(aStyleRule);
    assertEquals(4, aStyleRule.getDeclarationCount());
}
Also used : CascadingStyleSheet(com.helger.css.decl.CascadingStyleSheet) CSSStyleRule(com.helger.css.decl.CSSStyleRule) IReadableResource(com.helger.commons.io.resource.IReadableResource) ClassPathResource(com.helger.commons.io.resource.ClassPathResource) LoggingCSSParseErrorHandler(com.helger.css.reader.errorhandler.LoggingCSSParseErrorHandler) Test(org.junit.Test)

Example 37 with IReadableResource

use of com.helger.commons.io.resource.IReadableResource in project ph-css by phax.

the class IssueGC18Test method testIssue18.

@Test
public void testIssue18() {
    final IReadableResource aRes = new ClassPathResource("testfiles/css30/good/issue-gc-18.css");
    assertTrue(aRes.exists());
    final CascadingStyleSheet aCSS = CSSReader.readFromStream(aRes, StandardCharsets.UTF_8, ECSSVersion.CSS30, new LoggingCSSParseErrorHandler());
    assertNotNull(aCSS);
    if (false)
        System.out.println(new CSSWriter(ECSSVersion.CSS30).getCSSAsString(aCSS));
}
Also used : CascadingStyleSheet(com.helger.css.decl.CascadingStyleSheet) IReadableResource(com.helger.commons.io.resource.IReadableResource) CSSWriter(com.helger.css.writer.CSSWriter) ClassPathResource(com.helger.commons.io.resource.ClassPathResource) LoggingCSSParseErrorHandler(com.helger.css.reader.errorhandler.LoggingCSSParseErrorHandler) Test(org.junit.Test)

Aggregations

IReadableResource (com.helger.commons.io.resource.IReadableResource)37 Test (org.junit.Test)25 ClassPathResource (com.helger.commons.io.resource.ClassPathResource)18 CascadingStyleSheet (com.helger.css.decl.CascadingStyleSheet)12 LoggingCSSParseErrorHandler (com.helger.css.reader.errorhandler.LoggingCSSParseErrorHandler)12 SchematronOutputType (org.oclc.purl.dsdl.svrl.SchematronOutputType)11 SchematronResourcePure (com.helger.schematron.pure.SchematronResourcePure)9 FileSystemResource (com.helger.commons.io.resource.FileSystemResource)8 CSSWriter (com.helger.css.writer.CSSWriter)8 PSSchema (com.helger.schematron.pure.model.PSSchema)7 SVRLMarshaller (com.helger.schematron.svrl.SVRLMarshaller)7 CSSReaderSettings (com.helger.css.reader.CSSReaderSettings)6 AbstractSchematronResource (com.helger.schematron.AbstractSchematronResource)6 IMicroDocument (com.helger.xml.microdom.IMicroDocument)6 CollectingPSErrorHandler (com.helger.schematron.pure.errorhandler.CollectingPSErrorHandler)5 PSReader (com.helger.schematron.pure.exchange.PSReader)5 IPSErrorHandler (com.helger.schematron.pure.errorhandler.IPSErrorHandler)4 IMicroElement (com.helger.xml.microdom.IMicroElement)3 File (java.io.File)3 Nonnull (javax.annotation.Nonnull)3