Skip to content
Snippets Groups Projects
Commit 570aa838 authored by Torstein Strømme's avatar Torstein Strømme
Browse files

Added test case with different color arrangement

parent f2eed297
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,28 @@ public class TestGridView {
assertColorIsDrawnOnceAt(record, Color.GREEN, new Rectangle2D.Double(292.5, 200, 47.5, 40));
}
@Test
public void drawCellsIllustratedSampleDifferentColors() {
// Sample case from assignment text
IColorGrid sampleGrid = TestCellPositionToPixelConverter.newGridFromString(String.join("\n",
"Y--R",
"----",
"G--B"
));
Rectangle2D rect = new Rectangle2D.Double(30, 30, 340, 240);
double margin = 30;
RecordGraphics2D record = singleDrawCellsRun(sampleGrid, rect, margin);
// Check that the correct number of calls were made
assertEquals(12, record.getFillRecordShapes().size(),
"The drawCells method call draw 12 rectangles in the illustrated sample case");
assertColorIsDrawnOnceAt(record, Color.YELLOW, new Rectangle2D.Double(60, 60, 47.5, 40));
assertColorIsDrawnOnceAt(record, Color.RED, new Rectangle2D.Double(292.5, 60, 47.5, 40));
assertColorIsDrawnOnceAt(record, Color.GREEN, new Rectangle2D.Double(60, 200, 47.5, 40));
assertColorIsDrawnOnceAt(record, Color.BLUE, new Rectangle2D.Double(292.5, 200, 47.5, 40));
}
@Test
public void drawCellsIllustratedSampleTweak() {
// Sample case from assignment text
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment