How to unit test a Python function that draws PDF graphics?

前端 未结 5 1898
悲&欢浪女
悲&欢浪女 2020-12-09 10:01

I\'m writing a CAD application that outputs PDF files using the Cairo graphics library. A lot of the unit testing does not require actually generating the PDF files, such as

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-09 10:42

    The first idea that pops in my head is to use a diff utility. These are generally used to compare texts of documents but they might also compare the layout of the PDF. Using it, you can compare the expected output with the output supplied.

    The first result google gives me is this. Altough it is commercial, there might be other free/open source alternatives.

提交回复
热议问题