Home | Trees | Indices | Help |
|
---|
|
1 # -*- coding: iso-8859-1 -*- 2 """ 3 testcases for cssutils.stylesheets.MediaList 4 """ 5 __author__ = '$LastChangedBy: cthedot $' 6 __date__ = '$LastChangedDate: 2007-09-16 00:00:46 +0200 (So, 16 Sep 2007) $' 7 __version__ = '$LastChangedRevision: 359 $' 8 9 import xml.dom 10 import basetest 11 import cssutils.stylesheets 1214 1892 93 94 if __name__ == '__main__': 95 import unittest 96 unittest.main() 9720 "MediaQuery.mediaText" 21 tests = { 22 u'all': None, 23 u'a\\ll': None, 24 u'not tv': None, 25 u'n\\ot t\\v': None, 26 u'only tv': None, 27 u'\\only \\tv': None, 28 u'PRINT': None, 29 u'NOT PRINT': None, 30 u'ONLY PRINT': None, 31 u'tv and (color)': None, 32 u'not tv and (color)': None, 33 u'only tv and (color)': None, 34 } 35 self.do_equal_r(tests, att='mediaText') 36 37 tests = { 38 u'': xml.dom.SyntaxErr, 39 u'two values': xml.dom.SyntaxErr, 40 u'or even three': xml.dom.SyntaxErr, 41 u'print and(color)': xml.dom.SyntaxErr, # a function 42 u'3d': xml.dom.InvalidCharacterErr, # a dimension 43 } 44 self.do_raise_r(tests, att='_setMediaText')4547 "MediaQuery.mediaType" 48 mq = cssutils.stylesheets.MediaQuery() 49 50 self.assertEqual(u'', mq.mediaText) 51 52 for mt in cssutils.stylesheets.MediaQuery.MEDIA_TYPES: 53 mq.mediaType = mt 54 self.assertEqual(mq.mediaType, mt) 55 mq.mediaType = mt.upper() 56 self.assertEqual(mq.mediaType, mt.upper()) 57 58 mt = u'3D-UNKOwn-MEDIAtype0123' 59 #mq.mediaType = mt 60 self.assertRaises(xml.dom.InvalidCharacterErr, mq._setMediaType, mt)6163 "MediaQuery.mediaText comments" 64 tests = { 65 u'all': None, 66 u'print': None, 67 u'not print': None, 68 u'only print': None, 69 u'print and (color)': None, 70 u'print and (color) and (width)': None, 71 u'print and (color: 2)': None, 72 u'print and (min-width: 100px)': None, 73 u'print and (min-width: 100px) and (color: red)': None, 74 u'not print and (min-width: 100px)': None, 75 u'only print and (min-width: 100px)': None, 76 u'/*1*/ tv /*2*/': None, 77 u'/*0*/ only /*1*/ tv /*2*/': None, 78 u'/*0* /not /*1*/ tv /*2*/': None, 79 u'/*x*/ only /*x*/ print /*x*/ and /*x*/ (/*x*/min-width/*x*/: /*x*/100px/*x*/)': None, 80 u'print and/*1*/(color)': u'print and /*1*/ (color)' 81 } 82 self.do_equal_r(tests, att='mediaText')8385 "MediaQuery.__repr__(), .__str__()" 86 mediaText='tv and (color)' 87 s = cssutils.stylesheets.MediaQuery(mediaText=mediaText) 88 self.assert_(mediaText in str(s)) 89 s2 = eval(repr(s)) 90 self.assertEqual(mediaText, s2.mediaText) 91 self.assert_(isinstance(s2, s.__class__))
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Sun Jan 13 18:12:43 2008 | http://epydoc.sourceforge.net |