complain about missing BFC declarations

Sat, 22 Jun 2019 23:38:51 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 22 Jun 2019 23:38:51 +0300
changeset 68
c19dd0d3248e
parent 67
afaa4d3bc3e5
child 69
a24c4490d9f2

complain about missing BFC declarations

tests/misc.py file | annotate | diff | comparison | revisions
--- a/tests/misc.py	Sat Jun 22 23:35:03 2019 +0300
+++ b/tests/misc.py	Sat Jun 22 23:38:51 2019 +0300
@@ -92,13 +92,24 @@
     severity = 'hold',
     message = 'primitives must have CCW winding',
 )
-def primitive_ccw_test(model):
-    if model.header.valid \
+@problem_type('no-bfc-line',
+    severity = 'hold',
+    message = 'BFC declaration is missing',
+)
+def header_bfc_test(model):
+    def find_the_bfc_object(model):
+        return model.body[model.header.first_occurrence['bfc']],
+    if model.header.valid and not model.header.bfc:
+        yield report_problem(
+            'no-bfc-line',
+            bad_object = model.body[0],
+        )
+    elif model.header.valid \
     and model.header.filetype.endswith('Primitive') \
     and model.header.bfc != 'CERTIFY CCW':
         yield report_problem(
             'primitive-bfc-ccw',
-            bad_object = model.body[model.header.first_occurrence['bfc']],
+            bad_object = find_the_bfc_object(model),
         )
 
 manifest = {
@@ -109,6 +120,6 @@
         nocertify_test,
         physical_colours_test,
         unofficiality_test,
-        primitive_ccw_test,
+        header_bfc_test,
     ],
 }

mercurial