use of com.helger.commons.io.resource.IReadableResource in project ph-css by phax.
the class Issue17Test method testIssue.
@Test
public void testIssue() {
// Multiple errors contained
final IReadableResource aRes = new ClassPathResource("testfiles/css30/bad_but_browsercompliant/issue17.css");
assertTrue(aRes.exists());
final CascadingStyleSheet aCSS = CSSReader.readFromStream(aRes, new CSSReaderSettings().setFallbackCharset(StandardCharsets.UTF_8).setCSSVersion(ECSSVersion.CSS30).setCustomErrorHandler(new LoggingCSSParseErrorHandler()).setBrowserCompliantMode(true));
assertNotNull(aCSS);
}
use of com.helger.commons.io.resource.IReadableResource in project ph-css by phax.
the class Issue21Test method testIssue.
@Test
public void testIssue() {
// Multiple errors contained
final IReadableResource aRes = new ClassPathResource("testfiles/css30/good/issue21.css");
assertTrue(aRes.exists());
final CascadingStyleSheet aCSS = CSSReader.readFromStream(aRes, new CSSReaderSettings().setFallbackCharset(StandardCharsets.UTF_8).setCustomErrorHandler(new LoggingCSSParseErrorHandler()).setBrowserCompliantMode(true));
assertNotNull(aCSS);
if (false)
System.out.println(new CSSWriter(ECSSVersion.CSS30).getCSSAsString(aCSS));
assertEquals(2, aCSS.getRuleCount());
assertEquals(2, aCSS.getStyleRuleCount());
}
use of com.helger.commons.io.resource.IReadableResource in project ph-css by phax.
the class Issue9Test method testIssue9b.
@Test
public void testIssue9b() {
// File only ends with an invalid comment
final IReadableResource aRes = new ClassPathResource("testfiles/css30/bad/issue9b.css");
assertTrue(aRes.exists());
final CascadingStyleSheet aCSS = CSSReader.readFromStream(aRes, StandardCharsets.UTF_8, ECSSVersion.CSS30, new LoggingCSSParseErrorHandler());
assertNull(aCSS);
}
use of com.helger.commons.io.resource.IReadableResource in project ph-css by phax.
the class Issue9Test method testIssue9.
@Test
public void testIssue9() {
// File starts (and ends) with an invalid comment
final IReadableResource aRes = new ClassPathResource("testfiles/css30/bad/issue9.css");
assertTrue(aRes.exists());
final CascadingStyleSheet aCSS = CSSReader.readFromStream(aRes, StandardCharsets.UTF_8, ECSSVersion.CSS30, new LoggingCSSParseErrorHandler());
assertNull(aCSS);
}
use of com.helger.commons.io.resource.IReadableResource in project ph-css by phax.
the class IssueGC22Test method testIssue22.
@Test
public void testIssue22() {
final IReadableResource aRes = new ClassPathResource("testfiles/css30/good/issue-gc-22.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));
}
Aggregations