public void testSetProperty() throws Exception { Component component = new Component(); SetPropertyAction test = new SetPropertyAction(); assertFalse(test.isEnabled()); assertFalse(test.isVisible()); OurExplorerContext ec = new OurExplorerContext(); ec.component = component; test.setSelectedContext(ec); test.prepare(); assertTrue(test.isEnabled()); Form form = test.form(); DummyDialogue dv = DummyFormViewFactory.create(form).dialogue(); ((TextWidget) dv.get("Name")).setText("fruit"); SelectionWidget selection = (SelectionWidget) dv.get("Value"); DesignInstance value = selection.setSelected(new QTag("value")); DummyDialogue valueDialog = DummyFormViewFactory.create(value.detail()).dialogue(); ((TextWidget) valueDialog.get(null)).setText("apples"); test.action(); assertEquals("apples", component.fruit); }
public void testRootContext() { SetPropertyAction test = new SetPropertyAction(); test.setSelectedContext(new RootContext()); test.prepare(); assertFalse(test.isVisible()); assertFalse(test.isEnabled()); test.setSelectedContext(null); assertFalse(test.isVisible()); assertFalse(test.isEnabled()); }