use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class GridChangeUtilTest method test_insert_1.
public void test_insert_1() throws Exception {
final RadContainer grid = SampleGrid.create();
GridChangeUtil.insertRowOrColumn(grid, 1, false, false);
assertGridDimensions(grid, SampleGrid.ORIGINAL_ROWS, SampleGrid.ORIGINAL_COLUMNS + 1);
assertComponentCellAndSpan(grid, 0, 0, 4);
assertComponentCellAndSpan(grid, 1, 1, 4);
assertComponentCellAndSpan(grid, 2, 0, 5);
assertComponentCellAndSpan(grid, 3, 1, 1);
assertComponentCellAndSpan(grid, 4, 3, 3);
assertComponentCellAndSpan(grid, 5, 0, 1);
}
use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class GridChangeUtilTest method test_delete.
public void test_delete() throws Exception {
{
final RadContainer grid = SampleGrid.create();
assertEquals(GridChangeUtil.CellStatus.Required, GridChangeUtil.canDeleteCell(grid, 0, false));
assertEquals(GridChangeUtil.CellStatus.Required, GridChangeUtil.canDeleteCell(grid, 1, false));
assertEquals(GridChangeUtil.CellStatus.CanShift, GridChangeUtil.canDeleteCell(grid, 2, false));
assertEquals(GridChangeUtil.CellStatus.Redundant, GridChangeUtil.canDeleteCell(grid, 3, false));
assertEquals(GridChangeUtil.CellStatus.Redundant, GridChangeUtil.canDeleteCell(grid, 4, false));
}
for (int i = 0; i < SampleGrid.ORIGINAL_COLUMNS; i++) {
final RadContainer grid = SampleGrid.create();
if (GridChangeUtil.canDeleteCell(grid, i, false) != GridChangeUtil.CellStatus.Required) {
GridChangeUtil.deleteCell(grid, i, false);
assertGridDimensions(grid, SampleGrid.ORIGINAL_ROWS, SampleGrid.ORIGINAL_COLUMNS - 1);
} else {
// exception should be thrown
try {
GridChangeUtil.deleteCell(grid, i, false);
assertTrue(false);
} catch (IllegalArgumentException ok) {
}
}
}
// no rows in SampleGrid should be deletable...
{
final RadContainer grid = SampleGrid.create();
for (int i = 0; i < SampleGrid.ORIGINAL_ROWS; i++) {
assertEquals(GridChangeUtil.CellStatus.Required, GridChangeUtil.canDeleteCell(grid, i, true));
}
}
}
use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class GridChangeUtilTest method test_insert_after_and_before.
public void test_insert_after_and_before() throws Exception {
for (int i = 0; i < SampleGrid.ORIGINAL_COLUMNS - 1; i++) {
final RadContainer afterCurrent = SampleGrid.create();
GridChangeUtil.insertRowOrColumn(afterCurrent, i, false, false);
assertGridDimensions(afterCurrent, SampleGrid.ORIGINAL_ROWS, SampleGrid.ORIGINAL_COLUMNS + 1);
final RadContainer beforeNext = SampleGrid.create();
GridChangeUtil.insertRowOrColumn(beforeNext, i + 1, false, true);
assertGridDimensions(beforeNext, SampleGrid.ORIGINAL_ROWS, SampleGrid.ORIGINAL_COLUMNS + 1);
// afterCurrent and beforeNext grids should be same
assertGridsEqual(afterCurrent, beforeNext);
}
}
use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class GridChangeUtilTest method testMoveDisjointRowsUp.
public void testMoveDisjointRowsUp() throws Exception {
final RadContainer grid = SampleGrid.create();
GridChangeUtil.moveCells(grid, true, new int[] { 2, 4 }, 0);
assertEquals(0, grid.getComponent(2).getConstraints().getRow());
assertEquals(1, grid.getComponent(4).getConstraints().getRow());
assertEquals(2, grid.getComponent(0).getConstraints().getRow());
assertEquals(3, grid.getComponent(1).getConstraints().getRow());
}
use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.
the class GridChangeUtilTest method testMoveAdjacentRowsDown.
public void testMoveAdjacentRowsDown() throws Exception {
final RadContainer grid = SampleGrid.create();
GridChangeUtil.moveCells(grid, true, new int[] { 3, 4 }, 6);
assertEquals(4, grid.getComponent(3).getConstraints().getRow());
assertEquals(5, grid.getComponent(4).getConstraints().getRow());
assertEquals(3, grid.getComponent(5).getConstraints().getRow());
}
Aggregations