Пример #1
0
 def test_plot_area(self):
     """
     Test the get_available_width() and get_available_height() functions.
     They should return the material width and height minus the padding
     around the outside.
     """
     plot = Plot(90*12,90*12*4)
     plot.set_padding(35,0,35,0) # should be default but to make sure
     assert plot.get_available_width() == 90*12
     assert plot.get_available_height() == 90*12*4-70
Пример #2
0
 def test_plot_area(self):
     """
     Test the get_available_width() and get_available_height() functions.
     They should return the material width and height minus the padding
     around the outside.
     """
     plot = Plot(90 * 12, 90 * 12 * 4)
     plot.set_padding(35, 0, 35, 0)  # should be default but to make sure
     assert plot.get_available_width() == 90 * 12
     assert plot.get_available_height() == 90 * 12 * 4 - 70
Пример #3
0
 def test_set_padding(self):
     """ Test the set_padding() """
     plot = Plot(90*12,90*12*4)
     plot.set_padding(35,0,35,0)
     assert plot.get_available_width() == 90*12
     assert plot.get_available_height() == 90*12*4-70
     plot.set_padding(top=30)
     assert plot.get_available_width() == 90*12
     assert plot.get_available_height() == 90*12*4-65
     plot.set_padding(right=30)
     assert plot.get_available_width() == 90*12-30
     assert plot.get_available_height() == 90*12*4-65
     plot.set_padding(left=17.3)
     assert plot.get_available_width() == 90*12-30-17.3
     assert plot.get_available_height() == 90*12*4-65
     plot.set_padding(bottom=0)
     assert plot.get_available_width() == 90*12-30-17.3
     assert plot.get_available_height() == 90*12*4-30
     plot.set_padding(top=35,right=0,bottom=35,left=0)
     assert plot.get_available_width() == 90*12
     assert plot.get_available_height() == 90*12*4-70
     plot.set_padding(top=0,right=0,bottom=0,left=0)
     assert plot.get_available_width() == 90*12
     assert plot.get_available_height() == 90*12*4
Пример #4
0
 def test_set_padding(self):
     """ Test the set_padding() """
     plot = Plot(90 * 12, 90 * 12 * 4)
     plot.set_padding(35, 0, 35, 0)
     assert plot.get_available_width() == 90 * 12
     assert plot.get_available_height() == 90 * 12 * 4 - 70
     plot.set_padding(top=30)
     assert plot.get_available_width() == 90 * 12
     assert plot.get_available_height() == 90 * 12 * 4 - 65
     plot.set_padding(right=30)
     assert plot.get_available_width() == 90 * 12 - 30
     assert plot.get_available_height() == 90 * 12 * 4 - 65
     plot.set_padding(left=17.3)
     assert plot.get_available_width() == 90 * 12 - 30 - 17.3
     assert plot.get_available_height() == 90 * 12 * 4 - 65
     plot.set_padding(bottom=0)
     assert plot.get_available_width() == 90 * 12 - 30 - 17.3
     assert plot.get_available_height() == 90 * 12 * 4 - 30
     plot.set_padding(top=35, right=0, bottom=35, left=0)
     assert plot.get_available_width() == 90 * 12
     assert plot.get_available_height() == 90 * 12 * 4 - 70
     plot.set_padding(top=0, right=0, bottom=0, left=0)
     assert plot.get_available_width() == 90 * 12
     assert plot.get_available_height() == 90 * 12 * 4