"a {color: green; counter-increment: testCounter}\n" +
"b {font-weight: normal; counter-increment: testCounterTwo}" +
"* {color: blue}" +
"p {color: red; font-weight: bold; counter-increment: testCounter}";
StylingEngine engine = createStylingEngine(css);
Attributes attributes = createAttributes();
// <p>
engine.startElement(NS, "p", attributes);
assertStylesEqual(StylesBuilder.getSparseStyles(
"color: red; " +
"font-weight: bold; " +
"counter-increment: testCounter"),
engine);
assertEquals("Counter testCounter mismatch", 1,
engine.getCounterValue(counterIdentifier1));
assertEquals("Counter testCounter mismatch", 0,
engine.getCounterValue(counterIdentifier2));
{
// <a>
engine.startElement(NS, "a", attributes);
assertStylesEqual(StylesBuilder.getSparseStyles(
"color: green; " +
"font-weight: bold; " +
"counter-increment: testCounter"),
engine);
assertEquals("Counter testCounter mismatch", 2,
engine.getCounterValue(counterIdentifier1));
assertEquals("Counter testCounter mismatch", 0,
engine.getCounterValue(counterIdentifier2));
// </a>
engine.endElement(NS, "a");
}
{
// <b>
engine.startElement(NS, "b", attributes);
assertStylesEqual(StylesBuilder.getSparseStyles(
"color: blue; " +
"font-weight: normal; " +
"counter-increment: testCounterTwo"),
engine);
assertEquals("Counter testCounter mismatch", 2,
engine.getCounterValue(counterIdentifier1));
assertEquals("Counter testCounter mismatch", 1,
engine.getCounterValue(counterIdentifier2));
// </b>
engine.endElement(NS, "b");
}
// </p>
engine.endElement(NS, "p");
}