Search in sources :

Example 41 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.

the class ExpressionEditorColumnTest method testMinimalWidthNoCellsInMiddleWithPadding.

/**
 * (10)[100](10)
 * (10)-(10)
 * (10)[50][60](10)
 */
@Test
public void testMinimalWidthNoCellsInMiddleWithPadding() throws Exception {
    gridData.appendColumn(column);
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    mockCellsWithPadding(0, 0, PADDING, 100);
    mockCellsWithPadding(1, 0, PADDING);
    mockCellsWithPadding(2, 0, PADDING, 50, 60);
    Assertions.assertThat(column.getMinimumWidth()).isEqualTo(130);
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Test(org.junit.Test)

Example 42 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.

the class ExpressionEditorColumnTest method testMinimalWidthTwoCellsSum.

/**
 * [100]
 * [50][60]
 * [105]
 */
@Test
public void testMinimalWidthTwoCellsSum() throws Exception {
    gridData.appendColumn(column);
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    mockCells(0, 0, 100);
    mockCells(1, 0, 50, 60);
    mockCells(2, 0, 105);
    Assertions.assertThat(column.getMinimumWidth()).isEqualTo(110);
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Test(org.junit.Test)

Example 43 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.

the class ExpressionEditorColumnTest method testMinimalWidthDefaultWidth.

/**
 * [99]
 * [30][30][30]
 * [49][50]
 */
@Test
public void testMinimalWidthDefaultWidth() throws Exception {
    gridData.appendColumn(column);
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    mockCells(0, 0, 99);
    mockCells(1, 0, 30, 30, 30);
    mockCells(2, 0, 49, 50);
    Assertions.assertThat(column.getMinimumWidth()).isEqualTo(DEFAULT_WIDTH);
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Test(org.junit.Test)

Example 44 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow 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() throws Exception {
    gridData.appendColumn(column);
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    mockCellsWithPadding(0, 0, PADDING, 100);
    mockCellsWithPadding(1, 0, PADDING, 150);
    mockCellsWithPadding(2, 0, PADDING, 125);
    Assertions.assertThat(column.getMinimumWidth()).isEqualTo(170);
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Test(org.junit.Test)

Example 45 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.

the class ExpressionEditorColumnTest method testMinimalWidthOneCellInEachRow.

/**
 * [100]
 * [150]
 * [125]
 */
@Test
public void testMinimalWidthOneCellInEachRow() throws Exception {
    gridData.appendColumn(column);
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    mockCells(0, 0, 100d);
    mockCells(1, 0, 150);
    mockCells(2, 0, 125);
    Assertions.assertThat(column.getMinimumWidth()).isEqualTo(150);
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Test(org.junit.Test)

Aggregations

DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)67 Test (org.junit.Test)32 Before (org.junit.Before)16 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)13 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)12 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)12 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)12 List (org.kie.workbench.common.dmn.api.definition.v1_1.List)11 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)10 Optional (java.util.Optional)9 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)7 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)6 ContextEntry (org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)6 DecisionRule (org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule)6 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)6 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)6 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)6 ExpressionEditorDefinitions (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions)5 Binding (org.kie.workbench.common.dmn.api.definition.v1_1.Binding)4 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)4