diff options
Diffstat (limited to 'share/extensions/test')
| -rwxr-xr-x | share/extensions/test/render_gears.test.py (renamed from share/extensions/test/gears.test.py) | 2 | ||||
| -rwxr-xr-x | share/extensions/test/run-all-extension-tests | 6 | ||||
| -rwxr-xr-x | share/extensions/test/simplestyle.test.py | 122 |
3 files changed, 68 insertions, 62 deletions
diff --git a/share/extensions/test/gears.test.py b/share/extensions/test/render_gears.test.py index 964f675ad..ad1668126 100755 --- a/share/extensions/test/gears.test.py +++ b/share/extensions/test/render_gears.test.py @@ -10,7 +10,7 @@ import sys sys.path.append('..') # this line allows to import the extension code import unittest -from gears import * +from render_gears import * class GearsBasicTest(unittest.TestCase): diff --git a/share/extensions/test/run-all-extension-tests b/share/extensions/test/run-all-extension-tests index 1776e25b0..e7cba78f4 100755 --- a/share/extensions/test/run-all-extension-tests +++ b/share/extensions/test/run-all-extension-tests @@ -60,4 +60,8 @@ echo "" rm $py_cover_files $failed_tests -$fail && exit 1
\ No newline at end of file +if [ x$fail == xtrue ]; then + exit 1 +else + exit 0 +fi diff --git a/share/extensions/test/simplestyle.test.py b/share/extensions/test/simplestyle.test.py index 3c75ac43a..a4746ec09 100755 --- a/share/extensions/test/simplestyle.test.py +++ b/share/extensions/test/simplestyle.test.py @@ -1,63 +1,65 @@ #!/usr/bin/env python -import unittest, sys
-sys.path.append('..') # this line allows to import the extension code
-
-from simplestyle import parseColor, parseStyle
-
-
-class ParseColorTest(unittest.TestCase):
- """Test for single transformations"""
- def test_namedcolor(self):
- "Parse 'red'"
- col = parseColor('red')
- self.failUnlessEqual((255,0,0),col)
-
- def test_hexcolor4digit(self):
- "Parse '#ff0102'"
- col = parseColor('#ff0102')
- self.failUnlessEqual((255,1,2),col)
-
- def test_hexcolor3digit(self):
- "Parse '#fff'"
- col = parseColor('#fff')
- self.failUnlessEqual((255,255,255),col)
-
- def test_rgbcolorint(self):
- "Parse 'rgb(255,255,255)'"
- col = parseColor('rgb(255,255,255)')
- self.failUnlessEqual((255,255,255),col)
-
- def test_rgbcolorpercent(self):
- "Parse 'rgb(100%,100%,100%)'"
- col = parseColor('rgb(100%,100%,100%)')
- self.failUnlessEqual((255,255,255),col)
-
- def test_rgbcolorpercent2(self):
- "Parse 'rgb(100%,100%,100%)'"
- col = parseColor('rgb(50%,0%,1%)')
- self.failUnlessEqual((127,0,2),col)
-
- def test_rgbcolorpercentdecimal(self):
- "Parse 'rgb(66.667%,0%,6.667%)'"
- col = parseColor('rgb(66.667%,0%,6.667%)')
- self.failUnlessEqual((170, 0, 17),col)
-
- def test_currentColor(self):
- "Parse 'currentColor'"
- col = parseColor('currentColor')
- self.failUnlessEqual(('currentColor'),col)
-
- def test_spaceinstyle(self):
- "Parse 'stop-color: rgb(0,0,0)'"
- col = parseStyle('stop-color: rgb(0,0,0)')
- self.failUnlessEqual({'stop-color': 'rgb(0,0,0)'},col)
-
- #def test_unknowncolor(self):
- # "Parse 'unknown'"
- # col = parseColor('unknown')
- # self.failUnlessEqual((0,0,0),col)
- #
-
-if __name__ == '__main__':
+import unittest, sys +sys.path.append('..') # this line allows to import the extension code + +from simplestyle import parseColor, parseStyle + + +class ParseColorTest(unittest.TestCase): + """Test for single transformations""" + def test_namedcolor(self): + "Parse 'red'" + col = parseColor('red') + self.failUnlessEqual((255,0,0),col) + + def test_hexcolor4digit(self): + "Parse '#ff0102'" + col = parseColor('#ff0102') + self.failUnlessEqual((255,1,2),col) + + def test_hexcolor3digit(self): + "Parse '#fff'" + col = parseColor('#fff') + self.failUnlessEqual((255,255,255),col) + + def test_rgbcolorint(self): + "Parse 'rgb(255,255,255)'" + col = parseColor('rgb(255,255,255)') + self.failUnlessEqual((255,255,255),col) + + def test_rgbcolorpercent(self): + "Parse 'rgb(100%,100%,100%)'" + col = parseColor('rgb(100%,100%,100%)') + self.failUnlessEqual((255,255,255),col) + + def test_rgbcolorpercent2(self): + "Parse 'rgb(100%,100%,100%)'" + col = parseColor('rgb(50%,0%,1%)') + self.failUnlessEqual((127,0,2),col) + + def test_rgbcolorpercentdecimal(self): + "Parse 'rgb(66.667%,0%,6.667%)'" + col = parseColor('rgb(66.667%,0%,6.667%)') + self.failUnlessEqual((170, 0, 17),col) + + # TODO: This test appears to be broken. parseColor can + # only return an RGB colour code + #def test_currentColor(self): + # "Parse 'currentColor'" + # col = parseColor('currentColor') + # self.failUnlessEqual(('currentColor'),col) + + def test_spaceinstyle(self): + "Parse 'stop-color: rgb(0,0,0)'" + col = parseStyle('stop-color: rgb(0,0,0)') + self.failUnlessEqual({'stop-color': 'rgb(0,0,0)'},col) + + #def test_unknowncolor(self): + # "Parse 'unknown'" + # col = parseColor('unknown') + # self.failUnlessEqual((0,0,0),col) + # + +if __name__ == '__main__': unittest.main() |
