Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elrichgro
Flatland
Commits
cc6d8667
Commit
cc6d8667
authored
5 years ago
by
hagrid67
Browse files
Options
Downloads
Patches
Plain Diff
adding simple image rendering test
parent
7b40bafb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
images/basic-env.png
+0
-0
0 additions, 0 deletions
images/basic-env.png
tests/test_rendertools.py
+23
-0
23 additions, 0 deletions
tests/test_rendertools.py
with
23 additions
and
0 deletions
images/basic-env.png
0 → 100644
NaN GiB (NaN%)
View file @
cc6d8667
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
This diff is collapsed.
Click to expand it.
tests/test_rendertools.py
+
23
−
0
View file @
cc6d8667
...
...
@@ -5,6 +5,7 @@ from flatland.core.env import RailEnv
#from flatland.core.transitions import GridTransitions
import
numpy
as
np
import
random
import
os
from
recordtype
import
recordtype
...
...
@@ -26,6 +27,23 @@ import flatland.utils.rendertools as rt
def
checkFrozenImage
(
sFileImage
):
sTmpFileImage
=
"
images/test/
"
+
sFileImage
if
os
.
path
.
exists
(
sTmpFileImage
):
os
.
remove
(
sTmpFileImage
)
plt
.
savefig
(
sTmpFileImage
)
bytesFrozenImage
=
None
for
sDir
in
[
"
images/
"
,
"
images/test/
"
]:
sfPath
=
sDir
+
sFileImage
with
open
(
sfPath
,
"
rb
"
)
as
fIn
:
bytesImage
=
fIn
.
read
()
if
bytesFrozenImage
==
None
:
bytesFrozenImage
=
bytesImage
else
:
assert
(
bytesFrozenImage
==
bytesImage
)
def
test_render_env
():
...
...
@@ -37,3 +55,8 @@ def test_render_env():
oRT
=
rt
.
RenderTool
(
oEnv
)
plt
.
figure
(
figsize
=
(
10
,
10
))
oRT
.
renderEnv
()
checkFrozenImage
(
"
basic-env.png
"
)
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