Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11716,9 +11716,8 @@ public void shouldCalculateRowHeightByPosition() {
// Test calculated height
this.columnGroupHeaderLayer.setCalculateHeight(true);
assertEquals(20, this.columnGroupHeaderLayer.getHeight());
assertEquals(2, this.columnGroupHeaderLayer.getRowCount());
assertEquals(0, this.columnGroupHeaderLayer.getRowHeightByPosition(0));
assertEquals(20, this.columnGroupHeaderLayer.getRowHeightByPosition(1));
assertEquals(1, this.columnGroupHeaderLayer.getRowCount());
assertEquals(20, this.columnGroupHeaderLayer.getRowHeightByPosition(0));
}

@Test
Expand Down Expand Up @@ -11749,9 +11748,8 @@ public void shouldCalculateRowHeightOnGroupModelChanges() {
this.columnGroupHeaderLayer.clearAllGroups();

assertEquals(20, this.columnGroupHeaderLayer.getHeight());
assertEquals(2, this.columnGroupHeaderLayer.getRowCount());
assertEquals(0, this.columnGroupHeaderLayer.getRowHeightByPosition(0));
assertEquals(20, this.columnGroupHeaderLayer.getRowHeightByPosition(1));
assertEquals(1, this.columnGroupHeaderLayer.getRowCount());
assertEquals(20, this.columnGroupHeaderLayer.getRowHeightByPosition(0));

cell = this.columnGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals("Firstname", cell.getDataValue());
Expand All @@ -11760,7 +11758,7 @@ public void shouldCalculateRowHeightOnGroupModelChanges() {
assertEquals(1, cell.getColumnSpan());
assertEquals(0, cell.getOriginRowPosition());
assertEquals(0, cell.getRowPosition());
assertEquals(2, cell.getRowSpan());
assertEquals(1, cell.getRowSpan());

this.columnGroupHeaderLayer.setCalculateHeight(false);

Expand Down Expand Up @@ -14743,37 +14741,132 @@ public void shouldUpdateHeightOnHidingGroupedColumns() {

this.columnGroupHeaderLayer.setCalculateHeight(true);

// test the group states
assertTrue(this.columnGroupHeaderLayer.getGroupModel().isVisible());
assertEquals(4, nameGroup.getVisibleSpan());
assertEquals(4, addressGroup.getVisibleSpan());
assertEquals(40, this.columnGroupHeaderLayer.getHeight());
assertEquals(2, this.columnGroupHeaderLayer.getRowCount());

// test the first cell in the group header (grouped cell)
ILayerCell cell = this.columnGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals(0, cell.getOriginColumnPosition());
assertEquals(0, cell.getColumnPosition());
assertEquals(0, cell.getColumnIndex());
assertEquals(4, cell.getColumnSpan());
assertEquals(1, cell.getRowSpan());
assertEquals("Person", cell.getDataValue());
assertEquals(0, cell.getBounds().x);
assertEquals(0, cell.getBounds().y);
assertEquals(400, cell.getBounds().width);
assertEquals(20, cell.getBounds().height);

// test the first non grouped cell
cell = this.columnGroupHeaderLayer.getCellByPosition(8, 0);
assertEquals(8, cell.getOriginColumnPosition());
assertEquals(8, cell.getColumnPosition());
assertEquals(8, cell.getColumnIndex());
assertEquals(1, cell.getColumnSpan());
assertEquals(2, cell.getRowSpan());
assertEquals("Age", cell.getDataValue());
assertEquals(800, cell.getBounds().x);
assertEquals(0, cell.getBounds().y);
assertEquals(100, cell.getBounds().width);
assertEquals(40, cell.getBounds().height);

// hide columns in Person group
this.gridLayer.doCommand(new MultiColumnHideCommand(this.gridLayer, 1, 2, 3, 4));

// test the group states
assertTrue(this.columnGroupHeaderLayer.getGroupModel().isVisible());
assertEquals(0, nameGroup.getVisibleSpan());
assertEquals(4, addressGroup.getVisibleSpan());
assertEquals(40, this.columnGroupHeaderLayer.getHeight());
assertEquals(2, this.columnGroupHeaderLayer.getRowCount());

// test the first cell in the group header (grouped cell)
cell = this.columnGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals(0, cell.getOriginColumnPosition());
assertEquals(0, cell.getColumnPosition());
assertEquals(4, cell.getColumnIndex());
assertEquals(4, cell.getColumnSpan());
assertEquals(1, cell.getRowSpan());
assertEquals("Address", cell.getDataValue());
assertEquals(0, cell.getBounds().x);
assertEquals(0, cell.getBounds().y);
assertEquals(400, cell.getBounds().width);
assertEquals(20, cell.getBounds().height);

// test the first non grouped cell
cell = this.columnGroupHeaderLayer.getCellByPosition(4, 0);
assertEquals(4, cell.getOriginColumnPosition());
assertEquals(4, cell.getColumnPosition());
assertEquals(8, cell.getColumnIndex());
assertEquals(1, cell.getColumnSpan());
assertEquals(2, cell.getRowSpan());
assertEquals("Age", cell.getDataValue());
assertEquals(400, cell.getBounds().x);
assertEquals(0, cell.getBounds().y);
assertEquals(100, cell.getBounds().width);
assertEquals(40, cell.getBounds().height);

// hide columns in Address group
this.gridLayer.doCommand(new MultiColumnHideCommand(this.gridLayer, 1, 2, 3, 4));

// test the group states
assertFalse(this.columnGroupHeaderLayer.getGroupModel().isVisible());
assertEquals(0, nameGroup.getVisibleSpan());
assertEquals(0, addressGroup.getVisibleSpan());
assertEquals(20, this.columnGroupHeaderLayer.getHeight());
assertEquals(2, this.columnGroupHeaderLayer.getRowCount());
assertEquals(1, this.columnGroupHeaderLayer.getRowCount());

// test the first cell in the group header (now ungrouped cell)
cell = this.columnGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals(0, cell.getOriginColumnPosition());
assertEquals(0, cell.getColumnPosition());
assertEquals(8, cell.getColumnIndex());
assertEquals(1, cell.getColumnSpan());
assertEquals(1, cell.getRowSpan());
assertEquals("Age", cell.getDataValue());
assertEquals(0, cell.getBounds().x);
assertEquals(0, cell.getBounds().y);
assertEquals(100, cell.getBounds().width);
assertEquals(20, cell.getBounds().height);

// show all columns again
this.gridLayer.doCommand(new ShowAllColumnsCommand());

// test the group states
assertTrue(this.columnGroupHeaderLayer.getGroupModel().isVisible());
assertEquals(4, nameGroup.getVisibleSpan());
assertEquals(4, addressGroup.getVisibleSpan());
assertEquals(40, this.columnGroupHeaderLayer.getHeight());
assertEquals(2, this.columnGroupHeaderLayer.getRowCount());

// test the first cell in the group header (grouped cell)
cell = this.columnGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals(0, cell.getOriginColumnPosition());
assertEquals(0, cell.getColumnPosition());
assertEquals(0, cell.getColumnIndex());
assertEquals(4, cell.getColumnSpan());
assertEquals(1, cell.getRowSpan());
assertEquals("Person", cell.getDataValue());
assertEquals(0, cell.getBounds().x);
assertEquals(0, cell.getBounds().y);
assertEquals(400, cell.getBounds().width);
assertEquals(20, cell.getBounds().height);

// test the first non grouped cell
cell = this.columnGroupHeaderLayer.getCellByPosition(8, 0);
assertEquals(8, cell.getOriginColumnPosition());
assertEquals(8, cell.getColumnPosition());
assertEquals(8, cell.getColumnIndex());
assertEquals(1, cell.getColumnSpan());
assertEquals(2, cell.getRowSpan());
assertEquals("Age", cell.getDataValue());
assertEquals(800, cell.getBounds().x);
assertEquals(0, cell.getBounds().y);
assertEquals(100, cell.getBounds().width);
assertEquals(40, cell.getBounds().height);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11694,9 +11694,8 @@ public void shouldCalculateColumnWidthByPosition() {
// Test calculated width
this.rowGroupHeaderLayer.setCalculateWidth(true);
assertEquals(40, this.rowGroupHeaderLayer.getWidth());
assertEquals(2, this.rowGroupHeaderLayer.getColumnCount());
assertEquals(0, this.rowGroupHeaderLayer.getColumnWidthByPosition(0));
assertEquals(40, this.rowGroupHeaderLayer.getColumnWidthByPosition(1));
assertEquals(1, this.rowGroupHeaderLayer.getColumnCount());
assertEquals(40, this.rowGroupHeaderLayer.getColumnWidthByPosition(0));
}

@Test
Expand Down Expand Up @@ -11727,9 +11726,8 @@ public void shouldCalculateColumnWidthOnGroupModelChanges() {
this.rowGroupHeaderLayer.clearAllGroups();

assertEquals(40, this.rowGroupHeaderLayer.getWidth());
assertEquals(2, this.rowGroupHeaderLayer.getColumnCount());
assertEquals(0, this.rowGroupHeaderLayer.getColumnWidthByPosition(0));
assertEquals(40, this.rowGroupHeaderLayer.getColumnWidthByPosition(1));
assertEquals(1, this.rowGroupHeaderLayer.getColumnCount());
assertEquals(40, this.rowGroupHeaderLayer.getColumnWidthByPosition(0));

cell = this.rowGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals(1, cell.getDataValue());
Expand All @@ -11738,7 +11736,7 @@ public void shouldCalculateColumnWidthOnGroupModelChanges() {
assertEquals(1, cell.getRowSpan());
assertEquals(0, cell.getOriginColumnPosition());
assertEquals(0, cell.getColumnPosition());
assertEquals(2, cell.getColumnSpan());
assertEquals(1, cell.getColumnSpan());

this.rowGroupHeaderLayer.setCalculateWidth(false);

Expand Down Expand Up @@ -14719,38 +14717,124 @@ public void shouldUpdateWidthOnHidingGroupedColumns() {

this.rowGroupHeaderLayer.setCalculateWidth(true);

// test the group states
assertTrue(this.rowGroupHeaderLayer.getGroupModel().isVisible());
assertEquals(4, nameGroup.getVisibleSpan());
assertEquals(4, addressGroup.getVisibleSpan());
assertEquals(60, this.rowGroupHeaderLayer.getWidth());
assertEquals(2, this.rowGroupHeaderLayer.getColumnCount());

// test the first cell in the group header (grouped cell)
ILayerCell cell = this.rowGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals(0, cell.getOriginRowPosition());
assertEquals(4, cell.getRowSpan());
assertEquals("Person", cell.getDataValue());
assertEquals(0, cell.getBounds().y);
assertEquals(0, cell.getBounds().x);
assertEquals(80, cell.getBounds().height);
assertEquals(20, cell.getBounds().width);

// test the first non grouped cell
cell = this.rowGroupHeaderLayer.getCellByPosition(0, 8);
assertEquals(8, cell.getOriginRowPosition());
assertEquals(8, cell.getRowPosition());
assertEquals(8, cell.getRowIndex());
assertEquals(1, cell.getRowSpan());
assertEquals(2, cell.getColumnSpan());
assertEquals(9, cell.getDataValue());
assertEquals(160, cell.getBounds().y);
assertEquals(0, cell.getBounds().x);
assertEquals(20, cell.getBounds().height);
assertEquals(60, cell.getBounds().width);

// hide columns in Person group
this.gridLayer.doCommand(new MultiRowHideCommand(this.gridLayer, 1, 2, 3, 4));

// test the group states
assertTrue(this.rowGroupHeaderLayer.getGroupModel().isVisible());
assertEquals(0, nameGroup.getVisibleSpan());
assertEquals(4, addressGroup.getVisibleSpan());
assertEquals(60, this.rowGroupHeaderLayer.getWidth());
assertEquals(2, this.rowGroupHeaderLayer.getColumnCount());

// test the first cell in the group header (grouped cell)
cell = this.rowGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals(0, cell.getOriginRowPosition());
assertEquals(4, cell.getRowSpan());
assertEquals("Address", cell.getDataValue());
assertEquals(0, cell.getBounds().y);
assertEquals(0, cell.getBounds().x);
assertEquals(80, cell.getBounds().height);
assertEquals(20, cell.getBounds().width);

// test the first non grouped cell
cell = this.rowGroupHeaderLayer.getCellByPosition(0, 4);
assertEquals(4, cell.getOriginRowPosition());
assertEquals(4, cell.getRowPosition());
assertEquals(8, cell.getRowIndex());
assertEquals(1, cell.getRowSpan());
assertEquals(2, cell.getColumnSpan());
assertEquals(9, cell.getDataValue());
assertEquals(80, cell.getBounds().y);
assertEquals(0, cell.getBounds().x);
assertEquals(20, cell.getBounds().height);
assertEquals(60, cell.getBounds().width);

// hide columns in Address group
this.gridLayer.doCommand(new MultiRowHideCommand(this.gridLayer, 1, 2, 3, 4));

// test the group states
assertFalse(this.rowGroupHeaderLayer.getGroupModel().isVisible());
assertEquals(0, nameGroup.getVisibleSpan());
assertEquals(0, addressGroup.getVisibleSpan());
assertEquals(40, this.rowGroupHeaderLayer.getWidth());
assertEquals(2, this.rowGroupHeaderLayer.getColumnCount());
assertEquals(1, this.rowGroupHeaderLayer.getColumnCount());

// test the first cell in the group header (now ungrouped cell)
cell = this.rowGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals(0, cell.getOriginRowPosition());
assertEquals(0, cell.getRowPosition());
assertEquals(8, cell.getRowIndex());
assertEquals(1, cell.getRowSpan());
assertEquals(1, cell.getColumnSpan());
assertEquals(9, cell.getDataValue());
assertEquals(0, cell.getBounds().y);
assertEquals(0, cell.getBounds().x);
assertEquals(20, cell.getBounds().height);
assertEquals(40, cell.getBounds().width);

// show all columns again
this.gridLayer.doCommand(new ShowAllRowsCommand());

// test the group states
assertTrue(this.rowGroupHeaderLayer.getGroupModel().isVisible());
assertEquals(4, nameGroup.getVisibleSpan());
assertEquals(4, addressGroup.getVisibleSpan());
assertEquals(60, this.rowGroupHeaderLayer.getWidth());
assertEquals(2, this.rowGroupHeaderLayer.getColumnCount());

// test the first cell in the group header (grouped cell)
cell = this.rowGroupHeaderLayer.getCellByPosition(0, 0);
assertEquals(0, cell.getOriginRowPosition());
assertEquals(4, cell.getRowSpan());
assertEquals("Person", cell.getDataValue());
assertEquals(0, cell.getBounds().y);
assertEquals(0, cell.getBounds().x);
assertEquals(80, cell.getBounds().height);
assertEquals(20, cell.getBounds().width);

// test the first non grouped cell
cell = this.rowGroupHeaderLayer.getCellByPosition(0, 8);
assertEquals(8, cell.getOriginRowPosition());
assertEquals(8, cell.getRowPosition());
assertEquals(8, cell.getRowIndex());
assertEquals(1, cell.getRowSpan());
assertEquals(2, cell.getColumnSpan());
assertEquals(9, cell.getDataValue());
assertEquals(160, cell.getBounds().y);
assertEquals(0, cell.getBounds().x);
assertEquals(20, cell.getBounds().height);
assertEquals(60, cell.getBounds().width);
}

}
Loading