use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.
the class ThreeColorHeatmapHighlighterSerializerTest method serializeThreeColorHeatmapHighlighter_resultJsonHasType.
@Test
public void serializeThreeColorHeatmapHighlighter_resultJsonHasType() throws IOException {
// given
ThreeColorHeatmapHighlighter heatmapHighlighter = new ThreeColorHeatmapHighlighter("a", HighlightStyle.FULL_ROW) {
};
// when
JsonNode actualObj = serializeHighlighter(heatmapHighlighter);
// then
Assertions.assertThat(actualObj.has("type")).isTrue();
Assertions.assertThat(actualObj.get("type").asText()).isEqualTo("ThreeColorHeatmapHighlighter");
}
use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.
the class ThreeColorHeatmapHighlighterSerializerTest method serializeMidColor_resultJsonHasMidColor.
@Test
public void serializeMidColor_resultJsonHasMidColor() throws IOException {
// given
ThreeColorHeatmapHighlighter heatmapHighlighter = new ThreeColorHeatmapHighlighter("a", HighlightStyle.FULL_ROW, 1, 5, 10, Color.BLACK, Color.GREEN, Color.BLUE);
// when
JsonNode actualObj = serializeHighlighter(heatmapHighlighter);
// then
Assertions.assertThat(actualObj.has("midColor")).isTrue();
Assertions.assertThat(actualObj.get("midColor").get("rgb").asInt()).isEqualTo(Color.GREEN.getRGB());
}
use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.
the class ThreeColorHeatmapHighlighterSerializerTest method serializeMidValue_resultJsonHasMidValue.
@Test
public void serializeMidValue_resultJsonHasMidValue() throws IOException {
// given
ThreeColorHeatmapHighlighter heatmapHighlighter = new ThreeColorHeatmapHighlighter("a", HighlightStyle.FULL_ROW, 1, 5, 10);
// when
JsonNode actualObj = serializeHighlighter(heatmapHighlighter);
// then
Assertions.assertThat(actualObj.has("midVal")).isTrue();
Assertions.assertThat(actualObj.get("midVal").asInt()).isEqualTo(5);
}
use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.
the class TableDisplayTest method shouldSendCommMsgWhenRemoveAllCellHighlighters.
@Test
public void shouldSendCommMsgWhenRemoveAllCellHighlighters() throws Exception {
// given;
TableDisplayCellHighlighter uniqueEntriesHighlighter = TableDisplayCellHighlighter.getUniqueEntriesHighlighter(COL_1, TableDisplayCellHighlighter.FULL_ROW);
TableDisplayCellHighlighter heatmapHighlighter = TableDisplayCellHighlighter.getHeatmapHighlighter(COL_1, 0, 8, Color.ORANGE, Color.PINK);
ThreeColorHeatmapHighlighter colorHeatmapHighlighter = new ThreeColorHeatmapHighlighter(COL_1, TableDisplayCellHighlighter.SINGLE_COLUMN, 4, 6, 8, new Color(247, 106, 106), new Color(239, 218, 82), new Color(100, 189, 122));
tableDisplay.addCellHighlighter(uniqueEntriesHighlighter);
tableDisplay.addCellHighlighter(heatmapHighlighter);
tableDisplay.addCellHighlighter(colorHeatmapHighlighter);
kernel.clearMessages();
// when
tableDisplay.removeAllCellHighlighters();
// then
assertThat(tableDisplay.getCellHighlighters()).isEmpty();
LinkedHashMap model = getModelUpdate();
assertThat(model.size()).isEqualTo(1);
List actual = getValueAsList(model, CELL_HIGHLIGHTERS);
assertThat(actual).isEmpty();
}
use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.
the class TableDisplayTest method shouldSendCommMsgWhenAddThreeColorHighlighterForColumnChange.
@Test
public void shouldSendCommMsgWhenAddThreeColorHighlighterForColumnChange() throws Exception {
// given;
ThreeColorHeatmapHighlighter highlighter = new ThreeColorHeatmapHighlighter(COL_1, TableDisplayCellHighlighter.SINGLE_COLUMN, 4, 6, 8, new Color(247, 106, 106), new Color(239, 218, 82), new Color(100, 189, 122));
// when
tableDisplay.addCellHighlighter(highlighter);
// then
assertThat(tableDisplay.getCellHighlighters().get(0)).isEqualTo(highlighter);
LinkedHashMap model = getModelUpdate();
assertThat(model.size()).isEqualTo(1);
List actual = getValueAsList(model, CELL_HIGHLIGHTERS);
Map column = (Map) actual.get(0);
assertThat(column.get(ThreeColorHeatmapHighlighterSerializer.TYPE)).isEqualTo(ThreeColorHeatmapHighlighter.class.getSimpleName());
assertThat(column.get(ThreeColorHeatmapHighlighterSerializer.STYLE)).isEqualTo(TableDisplayCellHighlighter.SINGLE_COLUMN.toString());
assertThat(column.get(ThreeColorHeatmapHighlighterSerializer.MID_VAL)).isEqualTo(6);
assertThat(column.get(ThreeColorHeatmapHighlighterSerializer.MID_COLOR)).isNotNull();
}
Aggregations