use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthOneCellInEachRowWithPadding.
/**
* (10)[100](10)
* (10)[150](10)
* (10)[125](10)
*/
@Test
public void testMinimalWidthOneCellInEachRowWithPadding() {
gridData.appendColumn(column);
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
mockCellsWithPadding(0, 0, PADDING, 100);
mockCellsWithPadding(1, 0, PADDING, 150);
mockCellsWithPadding(2, 0, PADDING, 125);
assertThat(column.getMinimumWidth()).isEqualTo(170);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthDefaultWidth.
/**
* [99]
* [30][30][30]
* [49][50]
*/
@Test
public void testMinimalWidthDefaultWidth() {
gridData.appendColumn(column);
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
mockCells(0, 0, 99);
mockCells(1, 0, 30, 30, 30);
mockCells(2, 0, 49, 50);
assertThat(column.getMinimumWidth()).isEqualTo(DEFAULT_WIDTH);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthThreeCellsSumWithPadding.
/**
* (10)[100](10)
* (10)[50][60](10)
* (10)[50][60][10](10)
*/
@Test
public void testMinimalWidthThreeCellsSumWithPadding() {
gridData.appendColumn(column);
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
mockCellsWithPadding(0, 0, PADDING, 100);
mockCellsWithPadding(1, 0, PADDING, 50, 60);
mockCellsWithPadding(2, 0, PADDING, 50, 60, 10);
assertThat(column.getMinimumWidth()).isEqualTo(140);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthOneCellInEachRow.
/**
* [100]
* [150]
* [125]
*/
@Test
public void testMinimalWidthOneCellInEachRow() {
gridData.appendColumn(column);
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
mockCells(0, 0, 100d);
mockCells(1, 0, 150);
mockCells(2, 0, 125);
assertThat(column.getMinimumWidth()).isEqualTo(150);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class AddOutputClauseCommandTest method testCanvasCommandAddOutputClauseToRuleWithInputs.
@Test
public void testCanvasCommandAddOutputClauseToRuleWithInputs() throws Exception {
makeCommand(DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT + 1);
final String ruleInputValue = "in value";
final String ruleOutputValue = "out value";
dtable.getInput().add(new InputClause());
dtable.getRule().add(new DecisionRule() {
{
getInputEntry().add(new UnaryTests() {
{
getText().setValue(ruleInputValue);
}
});
getOutputEntry().add(new LiteralExpression() {
{
getText().setValue(ruleOutputValue);
}
});
}
});
// Graph command populates OutputEntries so overwrite with test values
final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler);
graphCommand.execute(graphCommandExecutionContext);
dtable.getRule().get(0).getOutputEntry().get(0).getText().setValue(ruleOutputValue);
doReturn(1).when(uiInputClauseColumn).getIndex();
doReturn(2).when(uiOutputClauseColumn).getIndex();
uiModel.appendColumn(uiInputClauseColumn);
uiModel.appendRow(new BaseGridRow());
uiModelMapper.fromDMNModel(0, 1);
final Command<AbstractCanvasHandler, CanvasViolation> canvasAddOutputClauseCommand = command.newCanvasCommand(canvasHandler);
canvasAddOutputClauseCommand.execute(canvasHandler);
assertEquals(ruleInputValue, uiModel.getRow(0).getCells().get(1).getValue().getValue());
assertEquals(ruleOutputValue, uiModel.getRow(0).getCells().get(2).getValue().getValue());
assertEquals(3, uiModel.getColumnCount());
assertEquals(CanvasCommandResultBuilder.SUCCESS, canvasAddOutputClauseCommand.undo(canvasHandler));
assertEquals(2, uiModel.getColumnCount());
verify(executeCanvasOperation).execute();
verify(undoCanvasOperation).execute();
verify(command, times(2)).updateParentInformation();
}
Aggregations