use of com.sldeditor.rendertransformation.CheckBoxRenderer in project sldeditor by robward-scisys.
the class CheckBoxRendererTest method testCheckBoxRenderer.
/**
* Test method for {@link
* com.sldeditor.rendertransformation.CheckBoxRenderer#CheckBoxRenderer(com.sldeditor.rendertransformation.FunctionTableModel)}.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
void testCheckBoxRenderer() {
JTable table = new JTable();
FunctionTableModel model = new FunctionTableModel();
assertNull(new CheckBoxRenderer(null).getTableCellRendererComponent(null, null, false, false, 0, 0));
assertNull(new CheckBoxRenderer(null).getTableCellRendererComponent(table, null, false, false, 0, 0));
assertNull(new CheckBoxRenderer(model).getTableCellRendererComponent(null, null, false, false, 0, 0));
model.addNewValue(0);
ProcessFunction processFunction = createProcessFunction();
FunctionName name = new FunctionNameImpl("Test", parameter("cellSize", Double.class), new Parameter("outputBBOX", Number.class, null, null, false, 0, 100, null, null), parameter("outputWidth", Number.class), parameter("outputHeight", Number.class));
assertFalse(name.getArguments().get(0).isRequired());
assertTrue(name.getArguments().get(1).isRequired());
model.populate(name, processFunction);
CheckBoxRenderer obj = new CheckBoxRenderer(model);
// Row - optional and not selected
assertEquals(obj, obj.getTableCellRendererComponent(table, null, false, false, 0, 0));
assertEquals(obj, obj.getTableCellRendererComponent(table, true, false, false, 0, 0));
assertTrue(obj.isSelected());
assertEquals(obj, obj.getTableCellRendererComponent(table, false, false, false, 0, 0));
assertFalse(obj.isSelected());
// Row - optional and selected
assertEquals(obj, obj.getTableCellRendererComponent(table, null, true, false, 0, 0));
assertEquals(obj, obj.getTableCellRendererComponent(table, true, true, false, 0, 0));
assertTrue(obj.isSelected());
assertEquals(obj, obj.getTableCellRendererComponent(table, false, true, false, 0, 0));
assertFalse(obj.isSelected());
// Row - required and not selected
assertEquals(JLabel.class, obj.getTableCellRendererComponent(table, null, false, false, 1, 0).getClass());
// Row - required and selected
assertEquals(JLabel.class, obj.getTableCellRendererComponent(table, null, true, false, 1, 0).getClass());
}
Aggregations