Exemple #1
0
 def test_filename(self):
     """Check that custom filename works"""
     custom_filename = "test_filename.png"
     renderer = gj.Grass3dRenderer(filename=custom_filename)
     # Add files to self for cleanup later
     self.files.append(custom_filename)
     renderer.render(elevation_map="elevation", color_map="elevation")
     self.assertFileExists(custom_filename)
Exemple #2
0
 def test_hw(self):
     """Check that custom width and height works"""
     renderer = gj.Grass3dRenderer(width=200, height=400)
     renderer.render(elevation_map="elevation", color_map="elevation")
     self.assertFileExists(renderer.filename)
Exemple #3
0
 def test_defaults(self):
     """Check that default settings work"""
     renderer = gj.Grass3dRenderer()
     renderer.render(elevation_map="elevation", color_map="elevation")
     self.assertFileExists(renderer.filename)
Exemple #4
0
 def test_image_creation(self):
     """Check that show() works"""
     renderer = gj.Grass3dRenderer()
     renderer.render(elevation_map="elevation", color_map="elevation")
     self.assertTrue(renderer.show(),
                     "Failed to create IPython Image object")
Exemple #5
0
 def test_shortcut_error(self):
     """Check that wrong screen backend fails"""
     with self.assertRaisesRegex(ValueError, "does_not_exist"):
         gj.Grass3dRenderer(screen_backend="does_not_exist")
Exemple #6
0
 def test_pyvirtualdisplay_backend(self):
     """Check that pyvirtualdisplay backend works"""
     renderer = gj.Grass3dRenderer(screen_backend="pyvirtualdisplay")
     renderer.render(elevation_map="elevation", color_map="elevation")
     self.assertFileExists(renderer.filename)
Exemple #7
0
 def test_overlay(self):
     """Check that overlay works"""
     renderer = gj.Grass3dRenderer()
     renderer.render(elevation_map="elevation", color_map="elevation")
     renderer.overlay.d_legend(raster="elevation", at=(60, 97, 87, 92))
     self.assertFileExists(renderer.filename)