use of org.csstudio.display.builder.model.widgets.plots.ImageWidget in project org.csstudio.display.builder by kasemir.
the class RulesTest method testValueAsExpression.
/**
* Rules that uses the value of a PV within an expression
*/
@Test
public void testValueAsExpression() throws Exception {
final Widget widget = new ImageWidget();
final RuleInfo rule = new RuleInfo("WidthFromPV", "data_width", true, Arrays.asList(new RuleInfo.ExprInfoString("true", "pv0")), Arrays.asList(new ScriptPV("XSize")));
System.out.println(rule);
final String script = RuleToScript.generatePy(widget, rule);
System.out.println(script);
// Script must read the PV
assertThat(script, containsString("PVUtil.get"));
}
use of org.csstudio.display.builder.model.widgets.plots.ImageWidget in project org.csstudio.display.builder by kasemir.
the class RulesTest method testValueForCondition.
/**
* Rule that checks pv0>10 and picks a certain value for that
*/
@Test
public void testValueForCondition() throws Exception {
final ImageWidget widget = new ImageWidget();
final WidgetProperty<Integer> width = widget.propDataWidth().clone();
width.setValue(47);
final RuleInfo rule = new RuleInfo("WidthBasedOnPV", "data_width", false, Arrays.asList(new RuleInfo.ExprInfoValue<Integer>("pv0>10", width)), Arrays.asList(new ScriptPV("XSize")));
System.out.println(rule);
final String script = RuleToScript.generatePy(widget, rule);
System.out.println(script);
// Script must read the PV
assertThat(script, containsString("pv0 = PVUtil.getDouble(pvs[0])"));
}
Aggregations