assertEquals(0, stylesheet.getSpriteStyleNameSpace()
.getClassRulesCount());
// All nodes should have a border of 10px except the clicked ones.
Style sA = sgs.getStyleForElement(A);
Style sB = sgs.getStyleForElement(B);
Style sC = sgs.getStyleForElement(C);
Style sD = sgs.getStyleForElement(D);
assertEquals(10, sA.getStrokeWidth().value, 0);
assertEquals(10, sB.getStrokeWidth().value, 0);
assertEquals(10, sC.getStrokeWidth().value, 0);
assertEquals(10, sD.getStrokeWidth().value, 0);
sgs.pushEvent("clicked");
sA = sgs.getStyleForElement(A);
sB = sgs.getStyleForElement(B);
sC = sgs.getStyleForElement(C);
sD = sgs.getStyleForElement(D);
assertEquals(2, sA.getStrokeWidth().value, 0);
assertEquals(3, sB.getStrokeWidth().value, 0);
assertEquals(3, sC.getStrokeWidth().value, 0);
assertEquals(3, sD.getStrokeWidth().value, 0);
sgs.popEvent("clicked");
sA = sgs.getStyleForElement(A);
sB = sgs.getStyleForElement(B);
sC = sgs.getStyleForElement(C);
sD = sgs.getStyleForElement(D);
assertEquals(10, sA.getStrokeWidth().value, 0);
assertEquals(10, sB.getStrokeWidth().value, 0);
assertEquals(10, sC.getStrokeWidth().value, 0);
assertEquals(10, sD.getStrokeWidth().value, 0);
// Now augment the style sheet with a change that applies only to node
// B.
stylesheet.parseFromString(styleSheet3);
assertEquals(7, sgs.getGroupCount());
assertEquals(0, stylesheet.getGraphStyleNameSpace().getIdRulesCount());
assertEquals(0, stylesheet.getGraphStyleNameSpace()
.getClassRulesCount());
assertEquals(2, stylesheet.getNodeStyleNameSpace().getIdRulesCount()); // <--
// +1
assertEquals(2, stylesheet.getNodeStyleNameSpace().getClassRulesCount());
assertEquals(1, stylesheet.getEdgeStyleNameSpace().getIdRulesCount());
assertEquals(0, stylesheet.getEdgeStyleNameSpace().getClassRulesCount());
assertEquals(0, stylesheet.getSpriteStyleNameSpace().getIdRulesCount());
assertEquals(0, stylesheet.getSpriteStyleNameSpace()
.getClassRulesCount());
sA = sgs.getStyleForElement(A);
sB = sgs.getStyleForElement(B);
sC = sgs.getStyleForElement(C);
sD = sgs.getStyleForElement(D);
assertEquals(10, sA.getStrokeWidth().value, 0);
assertEquals(5, sB.getStrokeWidth().value, 0); // <-- The specific style
// changed.
assertEquals(10, sC.getStrokeWidth().value, 0);
assertEquals(10, sD.getStrokeWidth().value, 0);
// Now augment the style sheet with a change that applies to all edges
// with the ".foo" class.
stylesheet.parseFromString(styleSheet4);
assertEquals(8, sgs.getGroupCount()); // (e_AB disappears, e_AB(foo) and
// e(foo) appear)
assertEquals(0, stylesheet.getGraphStyleNameSpace().getIdRulesCount());
assertEquals(0, stylesheet.getGraphStyleNameSpace()
.getClassRulesCount());
assertEquals(2, stylesheet.getNodeStyleNameSpace().getIdRulesCount());
assertEquals(2, stylesheet.getNodeStyleNameSpace().getClassRulesCount());
assertEquals(1, stylesheet.getEdgeStyleNameSpace().getIdRulesCount());
assertEquals(1, stylesheet.getEdgeStyleNameSpace().getClassRulesCount()); // <--
// +1
assertEquals(0, stylesheet.getSpriteStyleNameSpace().getIdRulesCount());
assertEquals(0, stylesheet.getSpriteStyleNameSpace()
.getClassRulesCount());
Style sAB = sgs.getStyleForElement(AB);
Style sBC = sgs.getStyleForElement(BC);
Style sCD = sgs.getStyleForElement(CD);
Style sDA = sgs.getStyleForElement(DA);
assertEquals(2, sAB.getStrokeWidth().value, 0);
assertEquals(2, sBC.getStrokeWidth().value, 0);
assertEquals(1, sCD.getStrokeWidth().value, 0);
assertEquals(1, sDA.getStrokeWidth().value, 0);
System.err.printf(
"After adding new style sheets, there are %d groups !!%n",
sgs.getGroupCount());
Iterator<? extends StyleGroup> i = sgs.getGroupIterator();