317 |
self.assertEquals(half.GetFill(), Color(1, 0.5, 0.5)) |
self.assertEquals(half.GetFill(), Color(1, 0.5, 0.5)) |
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): |
class TestFixedRamp(unittest.TestCase): |
322 |
|
|
323 |
def test(self): |
def test(self): |
324 |
|
"""Test FixedRamp""" |
325 |
eq = self.assertEquals |
eq = self.assertEquals |
326 |
|
|
327 |
for lineColor, lineWidth, fillColor in \ |
for lineColor, lineWidth, fillColor in \ |
334 |
|
|
335 |
for i in [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]: |
for i in [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]: |
336 |
props = framp.GetProperties(i) |
props = framp.GetProperties(i) |
337 |
if lineColor: eq(props.GetLineColor(), lineColor) |
grey = Color(1 - i, 1 - i, 1 - i) |
338 |
if lineWidth: eq(props.GetLineWidth(), lineWidth) |
if lineColor is not None: |
339 |
if fillColor: eq(props.GetFill(), fillColor) |
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() |