示例#1
0
文件: tests.py 项目: l0b0/img2scad
 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))
示例#2
0
文件: tests.py 项目: l0b0/img2scad
 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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#11
0
文件: tests.py 项目: l0b0/img2scad
 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))
示例#12
0
文件: tests.py 项目: l0b0/img2scad
 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))
示例#13
0
文件: tests.py 项目: l0b0/img2scad
 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))
示例#14
0
文件: tests.py 项目: l0b0/img2scad
 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))
示例#15
0
文件: tests.py 项目: l0b0/img2scad
 def test_black(self):
     """A black image gives no cubes."""
     result = img2scad.img2scad(open(EXAMPLE_BLACK))
     self.assertFalse(search(r'translate.*cube', result))
示例#16
0
文件: tests.py 项目: l0b0/img2scad
 def test_small(self):
     """A single pixel image gives one cube."""
     result = img2scad.img2scad(open(EXAMPLE_SMALL))
     self.assertTrue(search(r'translate.*cube', result))