in plot-stem/src/jvmTest/kotlin/org/jetbrains/letsPlot/core/spec/config/ScaleConfigDiscreteScaleTest.kt [79:155]
fun params(): List<Array<Any?>> {
return listOf(
testParams(),
testParams(
breaks = listOf("B"),
expectedBreaks = listOf("B"),
expectedLabels = listOf("B"),
expectedBreakColors = getColors(CAT_DATA.size, listOf(0)),
expectedDataPointColors = getColors(
CAT_DATA.size,
listOf(1, 0, 2)
) // data: A, B, C. Index after reordering: 1, 0, 2 : (B, A, C). A, C - hidden
),
testParams(
limits = listOf("B"),
expectedBreaks = listOf("B"),
expectedLabels = listOf("B"),
expectedBreakColors = getColors(CAT_DATA.size, listOf(0)),
expectedDataPointColors = listOf(
NA_COLOR,
getColors(CAT_DATA.size)[0],
NA_COLOR
)
),
testParams(
limits = listOf("B", "C", "A"), // reorder
expectedBreaks = listOf("B", "C", "A"),
expectedLabels = listOf("B", "C", "A"),
// expectedBreakColors = // colors order is not affected
expectedDataPointColors = getColors(
CAT_DATA.size,
listOf(2, 0, 1)
) // data: A, B, C. Index after reordering: 2, 0, 1
),
testParams(
limits = listOf("B", "C", "A"), // reorder
labels = listOf("A-lab", "B-lab", "C-lab"), // labels without "defined" breaks.
expectedBreaks = listOf("B", "C", "A"),
expectedLabels = listOf("A-lab", "B-lab", "C-lab"), // limits do not change the labels order
// expectedBreakColors = // colors order is not affected
expectedDataPointColors = getColors(
CAT_DATA.size,
listOf(2, 0, 1)
) // data: A, B, C. Index after reordering: 2, 0, 1
),
testParams(
outputColors = listOf("red", "green", "blue"),
expectedBreakColors = listOf(Color.RED, Color.GREEN, Color.BLUE),
expectedDataPointColors = listOf(Color.RED, Color.GREEN, Color.BLUE)
),
testParams(
outputColors = listOf("red", "green"), // less than the data size (3).
expectedBreakColors = listOf(Color.RED, Color.GREEN, Color.RED),
expectedDataPointColors = listOf(Color.RED, Color.GREEN, Color.RED)
),
testParams(
breaks = listOf("B", "E"), // break "E" is not present in data.
expectedBreaks = listOf("B", "E"),
expectedLabels = listOf("B", "E"),
expectedBreakColors = getColors(CAT_DATA.size + 1, listOf(0, 1)), // breaks - first
expectedDataPointColors = getColors(
CAT_DATA.size + 1,
listOf(2, 0, 3)
) // data: A, B, C. Index after reordering: 2, 0, 3 : (B, E, A, C). A, C - hidden
),
testParams(
breaks = listOf("E", "B"), // break "E" is not present in data.
expectedBreaks = listOf("E", "B"),
expectedLabels = listOf("E", "B"),
expectedBreakColors = getColors(CAT_DATA.size + 1, listOf(0, 1)), // breaks - first
expectedDataPointColors = getColors(
CAT_DATA.size + 1,
listOf(2, 1, 3)
) // data: A, B, C. Index after reordering: 2, 1, 3 : (E, B, A, C). A, C - hidden
),
)
}