// Test a pristine UIGraphic instance public void testPristine() { super.testPristine(); UIGraphic graphic = (UIGraphic) component; assertNull("no value", graphic.getValue()); assertNull("no url", graphic.getUrl()); }
// Test attribute-property transparency public void testAttributesTransparency() { super.testAttributesTransparency(); UIGraphic graphic = (UIGraphic) component; assertEquals(graphic.getValue(), (String) component.getAttributes().get("value")); graphic.setValue("foo"); assertEquals("foo", (String) component.getAttributes().get("value")); graphic.setValue(null); assertNull((String) component.getAttributes().get("value")); component.getAttributes().put("value", "bar"); assertEquals("bar", graphic.getValue()); component.getAttributes().put("value", null); assertNull(graphic.getValue()); assertEquals(graphic.getUrl(), (String) graphic.getAttributes().get("url")); graphic.setUrl("foo"); assertEquals("foo", (String) graphic.getAttributes().get("url")); graphic.setUrl(null); assertNull((String) graphic.getAttributes().get("url")); graphic.getAttributes().put("url", "bar"); assertEquals("bar", graphic.getUrl()); graphic.getAttributes().put("url", null); assertNull(graphic.getUrl()); }
public void PENDING_FIXME_testValueBindings() { super.testValueBindings(); UIGraphic test = (UIGraphic) component; // "value" property request.setAttribute("foo", "bar"); test.setValue(null); assertNull(test.getValue()); test.setValueBinding("value", application.createValueBinding("#{foo}")); assertNotNull(test.getValueBinding("value")); assertEquals("bar", test.getValue()); test.setValue("baz"); assertEquals("baz", test.getValue()); test.setValue(null); assertEquals("bar", test.getValue()); test.setValueBinding("value", null); assertNull(test.getValueBinding("value")); assertNull(test.getValue()); }
// Test setting properties to valid values public void testPropertiesValid() throws Exception { super.testPropertiesValid(); UIGraphic graphic = (UIGraphic) component; // value graphic.setValue("foo.bar"); assertEquals("expected value", "foo.bar", graphic.getValue()); graphic.setValue(null); assertNull("erased value", graphic.getValue()); // Test transparency between "value" and "url" properties graphic.setUrl("foo"); assertEquals("foo", (String) graphic.getValue()); graphic.setUrl(null); assertNull(graphic.getValue()); graphic.setValue("bar"); assertEquals("bar", graphic.getUrl()); graphic.setValue(null); assertNull(graphic.getUrl()); // Transparency applies to value bindings as well assertNull(graphic.getValueBinding("url")); assertNull(graphic.getValueBinding("value")); request.setAttribute("foo", "bar"); ValueBinding vb = application.createValueBinding("#{foo}"); graphic.setValueBinding("url", vb); assertTrue(vb == graphic.getValueBinding("url")); assertTrue(vb == graphic.getValueBinding("value")); graphic.setValueBinding("url", null); assertNull(graphic.getValueBinding("url")); assertNull(graphic.getValueBinding("value")); graphic.setValueBinding("value", vb); assertTrue(vb == graphic.getValueBinding("url")); assertTrue(vb == graphic.getValueBinding("value")); graphic.setValueBinding("url", null); assertNull(graphic.getValueBinding("url")); assertNull(graphic.getValueBinding("value")); }