Changeset 141 for trunk/tests/chart.py

Show
Ignore:
Timestamp:
02/03/09 16:14:37 (3 years ago)
Author:
lgs
Message:

Test that shows the problem of ticket #15

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/chart.py

    r112 r141  
    212212        self.assertRaises(NotImplementedError, ch._renderChart, None) 
    213213 
     214    def test_range(self): 
     215        surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 500, 500) 
     216        opt = {'axis': {'x': {'range': (1, 10)}, 'y': {'range': (1.0, 10.0)}}} 
     217        ch = pycha.chart.Chart(surface, opt) 
     218        dataset = ( 
     219            ('dataset1', ([0, 1], [1, 1], [2, 3])), 
     220            ) 
     221        ch.addDataset(dataset) 
     222        ch._updateXY() 
     223        self.assertAlmostEqual(ch.xrange, 9, 4) 
     224        self.assertAlmostEqual(ch.yrange, 9, 4) 
     225        self.assertAlmostEqual(ch.xscale, 0.1111, 4) 
     226        self.assertAlmostEqual(ch.yscale, 0.1111, 4) 
     227 
     228 
    214229def test_suite(): 
    215230    return unittest.TestSuite(( 
     
    220235    )) 
    221236 
     237 
    222238if __name__ == '__main__': 
    223239    unittest.main(defaultTest='test_suite')