use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField in project scout.rt by eclipse.
the class AbstractProposalColumnTest method testPrepareLookupCallback.
/**
* Tests that {@link AbstractProposalColumn#execPrepareLookup(ILookupCall, ITableRow)} is called when
* {@link IProposalField#prepareKeyLookup(ILookupCall, Object)} is called on the editor field.
*/
@SuppressWarnings("unchecked")
@Test
public void testPrepareLookupCallback() {
TestProposalColumn column = new TestProposalColumn();
ITableRow row = Mockito.mock(ITableRow.class);
IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
ILookupCall call = mock(ILookupCall.class);
field.prepareKeyLookup(call, 10L);
assertEquals(row, column.lastRow);
assertEquals(call, column.lastCall);
}
use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField in project scout.rt by eclipse.
the class AbstractProposalColumnTest method testLookupRowWithTooLongText1.
@Test
public void testLookupRowWithTooLongText1() throws Exception {
final AbstractProposalColumn<Long> column = new AbstractProposalColumn<Long>() {
@Override
protected boolean getConfiguredEditable() {
return true;
}
@Override
protected int getConfiguredMaxLength() {
return 32;
}
};
column.setCodeTypeClass(TestCodeType.class);
final ITable table = new AbstractTable() {
@Override
protected void injectColumnsInternal(OrderedCollection<IColumn<?>> columns) {
columns.addFirst(column);
}
};
ITableRow row = table.addRow();
@SuppressWarnings("unchecked") IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
field.getUIFacade().acceptProposalFromUI("1234567890", false, false);
column.completeEdit(row, field);
assertEquals("1234567890", column.getValue(row));
}
Aggregations