/[thuban]/trunk/thuban/test/test_classgen.py
ViewVC logotype

Diff of /trunk/thuban/test/test_classgen.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1379 by bh, Tue Jul 8 13:23:20 2003 UTC revision 1450 by bh, Fri Jul 18 10:18:56 2003 UTC
# Line 21  from Thuban.Model.classgen import \ Line 21  from Thuban.Model.classgen import \
21      generate_uniform_distribution, \      generate_uniform_distribution, \
22      generate_quantiles, \      generate_quantiles, \
23      calculate_quantiles, \      calculate_quantiles, \
24      GreyRamp, CustomRamp      GreyRamp, CustomRamp, FixedRamp
25  from Thuban.Model.range import Range  from Thuban.Model.range import Range
26  from Thuban.Model.color import Color  from Thuban.Model.color import Color
27    
# Line 318  class TestCustomRamp(unittest.TestCase): Line 318  class TestCustomRamp(unittest.TestCase):
318          self.assertEquals(half.GetLineColor(), Color(0, 0.5, 0))          self.assertEquals(half.GetLineColor(), Color(0, 0.5, 0))
319    
320    
321    class TestFixedRamp(unittest.TestCase):
322    
323        def test(self):
324            """Test FixedRamp"""
325            eq = self.assertEquals
326    
327            for lineColor, lineWidth, fillColor in \
328                [(None, None, None), (Color(1, 1, 1), None, None),
329                 (None, 4, None), (None, None, Color(0, 1, 0)),
330                 (Color(1, 1, 1), 4, None), (Color(1, 1, 1), None, Color(0, 1, 0)),
331                 (None, 4, Color(0, 1, 0)), (Color(1, 1, 1), 4, Color(0, 1, 0))]:
332    
333                framp = FixedRamp(GreyRamp, (lineColor, lineWidth, fillColor))
334    
335                for i in [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]:
336                    props = framp.GetProperties(i)
337                    grey = Color(1 - i, 1 - i, 1 - i)
338                    if lineColor is not None:
339                        eq(props.GetLineColor(), lineColor)
340                    else:
341                        eq(props.GetLineColor(), grey)
342                    if lineWidth is not None:
343                        eq(props.GetLineWidth(), lineWidth)
344                    if fillColor is not None:
345                        eq(props.GetFill(), fillColor)
346                    else:
347                        eq(props.GetFill(), grey)
348    
349  if __name__ == "__main__":  if __name__ == "__main__":
350      unittest.main()      unittest.main()
351    

Legend:
Removed from v.1379  
changed lines
  Added in v.1450

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26