Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lab4-v23-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mattias.Nordahl
lab4-v23-1
Commits
570aa838
Commit
570aa838
authored
2 years ago
by
Torstein Strømme
Browse files
Options
Downloads
Patches
Plain Diff
Added test case with different color arrangement
parent
f2eed297
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/no/uib/inf101/gridview/TestGridView.java
+22
-0
22 additions, 0 deletions
src/test/java/no/uib/inf101/gridview/TestGridView.java
with
22 additions
and
0 deletions
src/test/java/no/uib/inf101/gridview/TestGridView.java
+
22
−
0
View file @
570aa838
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment