Hey all,

I'm trying to design a regtest for the DOM-id property. Ideally, I'd like to generate an svg file that is then checked by a python script to make sure that the property has been correctly set.

I have sketches of the files in question (see attached) and I'm wondering how I could design a GNUmakefile that:

-) compiles the lilypond file with -dbackend=svg
-) runs the python script on the result

The script raises a ValueError if the result is incorrect which (I think) would be enough to make `make check' fail.

I'm guessing that the GNUmakefile along with the .ly and .py file would go in a new folder input/regression/svg.

Could someone whose adept at build please give me some pointers on what this makefile would looklike and how to get it (and the new svg folder) integrated into the regtest process?

Thanks!

Cheers,
MS

<<attachment: quarter.svg>>

import xml.dom.minidom

dom = xml.dom.minidom.parse('quarter.svg')

def has_quarter(n) :
  if not isinstance(n, xml.dom.minidom.Element) : return False
  if 'quarternote' in n.getAttribute('id') : return True
  return False

def get_quarter(n) :
  return list(filter(has_quarter, n.childNodes)) + sum([get_quarter(x) for x in n.childNodes],[])

ds = set([
  filter(lambda y : y.tagName == 'path',
    filter(lambda y : isinstance(y, xml.dom.minidom.Element), x.childNodes))[0].getAttribute('d')
  for x in get_quarter(dom.documentElement)])

if len(ds) != 1 : raise ValueError('bad')


Attachment: quarter.ly
Description: Binary data

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to