Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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')
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    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')
Exemplo n.º 7
0
 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'))
Exemplo n.º 8
0
 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')
Exemplo n.º 9
0
 def test_delete(self):
     pic = Picture.add(name='pic1',
                       filename=os.path.join(this_dir,
                                             'sample_picture.png'))
     pic.delete()
     pic.name
Exemplo n.º 10
0
 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)
Exemplo n.º 11
0
 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'))
Exemplo n.º 12
0
 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')
Exemplo n.º 13
0
 def test_delete(self):
     pic = Picture.add(name='pic1', filename=os.path.join(this_dir, 'sample_picture.png'))
     pic.delete()
     pic.name
Exemplo n.º 14
0
 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)
Exemplo n.º 15
0
    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)
Exemplo n.º 16
0
    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')