Ejemplo n.º 1
0
 def test_big(self):
     """Check that a big image gives output."""
     result = img2scad.img2scad(
         open(EXAMPLE_BIG),
         base=5,
         log=True)
     self.assertTrue(search(r'translate.*cube', result))
Ejemplo n.º 2
0
 def test_log_one(self):
     """Log of 1 is zero."""
     result = img2scad.img2scad(
         open(EXAMPLE_BLACK),
         base=1,
         log=True)
     self.assertFalse(search(r'translate.*cube', result))
Ejemplo n.º 3
0
 def test_big(self):
     """Check that a big image gives output."""
     result = img2scad.img2scad(
         open(EXAMPLE_BIG),
         base = 5,
         log = True)
     self.assertTrue(search(r'translate.*cube', result))
Ejemplo n.º 4
0
 def test_log_one(self):
     """Log of 1 is zero."""
     result = img2scad.img2scad(
         open(EXAMPLE_BLACK),
         base = 1,
         log = True)
     self.assertFalse(search(r'translate.*cube', result))
Ejemplo n.º 5
0
 def test_log_zero(self):
     """Log of 0 is undefined, so we skip those."""
     result = img2scad.img2scad(open(EXAMPLE_BLACK), log=True)
     self.assertFalse(search(r'translate.*cube', result))
Ejemplo n.º 6
0
 def test_log(self):
     """Non-black images should be loggable."""
     result = img2scad.img2scad(open(EXAMPLE_SMALL), log=True)
     self.assertTrue(search(r'translate.*cube', result))
Ejemplo n.º 7
0
 def test_shift_to_zero(self):
     """A non-black pixel can be removed by the base offset."""
     result = img2scad.img2scad(open(EXAMPLE_SMALL), base=-152)
     self.assertFalse(search(r'translate.*cube', result))
Ejemplo n.º 8
0
 def test_black_base(self):
     """A black image gives output if a base is applied."""
     result = img2scad.img2scad(open(EXAMPLE_BLACK), base=1)
     self.assertTrue(search(r'translate.*cube', result))
Ejemplo n.º 9
0
 def test_black(self):
     """A black image gives no cubes."""
     result = img2scad.img2scad(open(EXAMPLE_BLACK))
     self.assertFalse(search(r'translate.*cube', result))
Ejemplo n.º 10
0
 def test_small(self):
     """A single pixel image gives one cube."""
     result = img2scad.img2scad(open(EXAMPLE_SMALL))
     self.assertTrue(search(r'translate.*cube', result))
Ejemplo n.º 11
0
 def test_log_zero(self):
     """Log of 0 is undefined, so we skip those."""
     result = img2scad.img2scad(
         open(EXAMPLE_BLACK),
         log=True)
     self.assertFalse(search(r'translate.*cube', result))
Ejemplo n.º 12
0
 def test_log(self):
     """Non-black images should be loggable."""
     result = img2scad.img2scad(
         open(EXAMPLE_SMALL),
         log=True)
     self.assertTrue(search(r'translate.*cube', result))
Ejemplo n.º 13
0
 def test_shift_to_zero(self):
     """A non-black pixel can be removed by the base offset."""
     result = img2scad.img2scad(
         open(EXAMPLE_SMALL),
         base=-152)
     self.assertFalse(search(r'translate.*cube', result))
Ejemplo n.º 14
0
 def test_black_base(self):
     """A black image gives output if a base is applied."""
     result = img2scad.img2scad(
         open(EXAMPLE_BLACK),
         base=1)
     self.assertTrue(search(r'translate.*cube', result))
Ejemplo n.º 15
0
 def test_black(self):
     """A black image gives no cubes."""
     result = img2scad.img2scad(open(EXAMPLE_BLACK))
     self.assertFalse(search(r'translate.*cube', result))
Ejemplo n.º 16
0
 def test_small(self):
     """A single pixel image gives one cube."""
     result = img2scad.img2scad(open(EXAMPLE_SMALL))
     self.assertTrue(search(r'translate.*cube', result))