예제 #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()
예제 #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)
예제 #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')
예제 #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)
예제 #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)
예제 #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')
예제 #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'))
예제 #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')
예제 #9
0
 def test_delete(self):
     pic = Picture.add(name='pic1',
                       filename=os.path.join(this_dir,
                                             'sample_picture.png'))
     pic.delete()
     pic.name
예제 #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)
예제 #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'))
예제 #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')
예제 #13
0
 def test_delete(self):
     pic = Picture.add(name='pic1', filename=os.path.join(this_dir, 'sample_picture.png'))
     pic.delete()
     pic.name
예제 #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)
예제 #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)
예제 #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')