Commits

Anonymous committed 5e40f4f

fixed Google Code Issue #55

  • Participants
  • Parent commits 39f3b35

Comments (0)

Files changed (2)

File src/cssutils/profiles.py

 macros[Profiles.CSS3_BASIC_USER_INTERFACE] = {
     'border-style': macros[Profiles.CSS3_BACKGROUNDS_AND_BORDERS]['border-style'],
     'border-width': macros[Profiles.CSS3_BACKGROUNDS_AND_BORDERS]['border-width'],
-    'outline-attrs': r'{outline-color}|{outline-style}|{outline-width}',
+    'outline-1': r'{outline-color}(\s+{outline-style})?(\s+{outline-width})?',
+    'outline-2': r'{outline-color}(\s+{outline-width})?(\s+{outline-style})?',
+    'outline-3': r'{outline-style}(\s+{outline-color})?(\s+{outline-width})?',
+    'outline-4': r'{outline-style}(\s+{outline-width})?(\s+{outline-color})?',
+    'outline-5': r'{outline-width}(\s+{outline-color})?(\s+{outline-style})?',
+    'outline-6': r'{outline-width}(\s+{outline-style})?(\s+{outline-color})?',
     'outline-color': r'{color}|invert|inherit',
     'outline-style': r'auto|{border-style}|inherit',
     'outline-width': r'{border-width}|inherit',
     }
 properties[Profiles.CSS3_BASIC_USER_INTERFACE] = {
-    'cursor': r'((({uri}{w}({number}{w}{number}{w})?,{w})*)?(auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|(e|n|ne|nw|s|se|sw|w|ew|ns|nesw|nwse|col|row)-resize|all-scroll))|inherit',    'outline-style': r'{outline-style}',
+    'cursor': r'((({uri}{w}({number}{w}{number}{w})?,{w})*)?(auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|(e|n|ne|nw|s|se|sw|w|ew|ns|nesw|nwse|col|row)-resize|all-scroll))|inherit',    
     'nav-index': r'auto|{number}|inherit',
+    'outline-color': r'{outline-color}',
+    'outline-style': r'{outline-style}',
     'outline-width': r'{outline-width}',
     'outline-offset': r'{length}|inherit',
-    'outline': r'{outline-attrs}(\s+{outline-attrs})*|inherit',
+    #'outline': r'{outline-attrs}(\s+{outline-attrs})*|inherit',
+    'outline': r'{outline-1}|{outline-2}|{outline-3}|{outline-4}|{outline-5}|{outline-6}|inherit',
     'resize': 'none|both|horizontal|vertical|inherit',
     }
 

File src/tests/test_profiles.py

                       'status-bar', 'inherit'
                       )): (True, True, CSS2),
             
-            # PROPERTY opacity
+            ('nav-index', ('1', 'auto', 'inherit')): (True, True, C3BUI),
+            ('nav-index', ('x', '1 2', '1px')): (False, False, C3BUI),
+            
             ('opacity', ('inherit',
                          '0', '0.0', '0.42342', '1', '1.0',
                          # should be clipped but valid
                          '-0', '-0.1', '-10', '2'
                          )): (True, True, CM3),
-            # invalid
             ('opacity', ('a', '#000', '+1')): (False, False, CM3),
 
-            ('nav-index', ('1', 'auto', 'inherit')): (True, True, C3BUI),
-            ('nav-index', ('x', '1 2', '1px')): (False, False, C3BUI),
-
+            ('outline', ('red dotted 1px', 
+                         'dotted 1px red',
+                         '1px red dotted',
+                         'red', '1px', 'dotted',
+                         'red 1px', '1px dotted', 'red dotted',
+                         'inherit'
+                               )): (True, True, C3BUI),
+            ('outline', ('red #fff', 'solid dotted', 'Url(x)', '1px 1px'
+                               )): (False, False, C3BUI),
+            ('outline-color', ('red', '#fff', 'inherit'
+                               )): (True, True, C3BUI),
+            ('outline-color', ('0', '1em'
+                               )): (False, False, C3BUI),
+            ('outline-offset', ('0', '1em', 'inherit'
+                               )): (True, True, C3BUI),
+            ('outline-offset', ('1%', 'red'
+                               )): (False, False, C3BUI),
+            ('outline-style', ('auto', 'dotted', 'inherit'
+                               )): (True, True, C3BUI),
+            ('outline-style', ('0', '1em', 'red'
+                               )): (False, False, C3BUI),
+            ('outline-width', ('0', '1em', 'inherit'
+                               )): (True, True, C3BUI),
+            ('outline-width', ('auto', 'red', 'dotted'
+                               )): (False, False, C3BUI),
+            
             ('resize', ('none', 
                         'both', 
                         'horizontal', 
                                )): (True, True, FM3FF),
         
         }
-        for (name, values), (v, m, p) in tests.items():            
+        for (name, values), (valid, matching, profile) in tests.items(): 
             for value in values:
-                self.assertEqual(v, cssutils.profile.validate(name, value))
-                self.assertEqual((v, m, list(p)), 
+                self.assertEqual(valid, cssutils.profile.validate(name, value))
+                self.assertEqual((valid, matching, list(profile)), 
                                  cssutils.profile.validateWithProfile(name, value))
 
     def test_validateByProfile(self):