def test_two_wkb(self): wb2 = Workbook(app_visible=False, app_target=APP_TARGET) pic1 = Picture.add(sheet=1, name='pic1', filename=os.path.join(this_dir, 'sample_picture.png')) pic2 = Picture.add(sheet=1, name='pic1', filename=os.path.join(this_dir, 'sample_picture.png'), wkb=self.wb) assert_equal(pic1.name, 'pic1') assert_equal(pic2.name, 'pic1') wb2.close()
def test_top(self): pic = Picture.add(name='pic1', filename=os.path.join(this_dir, 'sample_picture.png')) assert_equal(pic.left, 0) pic.top = 20 assert_equal(pic.top, 20)
def test_name(self): pic = Picture.add(name='pic1', filename=os.path.join(this_dir, 'sample_picture.png')) assert_equal(pic.name, 'pic1') pic.name = 'pic_new' assert_equal(pic.name, 'pic_new')
def test_height(self): pic = Picture.add(name='pic1', filename=os.path.join(this_dir, 'sample_picture.png')) if PIL: assert_equal(pic.height, 60) else: assert_equal(pic.height, 100) pic.height = 50 assert_equal(pic.height, 50)
def test_width(self): pic = Picture.add(name='pic1', filename=os.path.join(this_dir, 'sample_picture.png')) if PIL: assert_equal(pic.width, 60) else: assert_equal(pic.width, 100) pic.width = 50 assert_equal(pic.width, 50)
def test_add_plot(self): _skip_if_no_matplotlib() fig = Figure(figsize=(8, 6)) ax = fig.add_subplot(111) ax.plot([1, 2, 3, 4, 5]) plot = Plot(fig) pic = plot.show('Plot1') assert_equal(pic.name, 'Plot1') plot.show('Plot2', sheet=2) pic2 = Picture(2, 'Plot2') assert_equal(pic2.name, 'Plot2')
def test_picture_update(self): pic1 = Picture.add(os.path.join(this_dir, 'sample_picture.png'), name='pic1') pic1.update(os.path.join(this_dir, 'sample_picture.png'))
def test_duplicate(self): pic1 = Picture.add(os.path.join(this_dir, 'sample_picture.png'), name='pic1') pic2 = Picture.add(os.path.join(this_dir, 'sample_picture.png'), name='pic1')
def test_delete(self): pic = Picture.add(name='pic1', filename=os.path.join(this_dir, 'sample_picture.png')) pic.delete() pic.name
def test_picture_object(self): pic = Picture.add(name='pic1', filename=os.path.join(this_dir, 'sample_picture.png')) assert_equal(pic.name, Picture('pic1').name)