daqana / tikzDevice

A R package for producing graphics output as PGF/TikZ code for use in TeX documents.
https://daqana.github.io/tikzDevice
131 stars 26 forks source link

Test "Output regression check" fails #189

Open karldw opened 5 years ago

karldw commented 5 years ago

When I clone the repo and try to run the tests, I get a bunch of messages about "Output regression check" failing at this line. Here's the first one:

> devtools::test()
Loading tikzDevice
Ghostscript:  /usr/bin/gs 
compare:  /usr/bin/compare-im6.q16 
convert:  /usr/bin/convert-im6.q16 
Testing tikzDevice
✔ | OK F W S | Context
✔ | 13       | Test tikzDevice error and warning messages [1.7 s]
✖ |  2 1 1   | Draw a circle and some simple text [3.7 s]
────────────────────────────────────────────────────────────────────────────────
helper_graphics.R:65: warning: Output regression check
NAs introduced by coercion

helper_graphics.R:65: error: Output regression check
missing value where TRUE/FALSE needed
1: eval(bquote(expect_lt(compare_graph(.(short_name), tags), .(fuzz) + 0.1))) at tests/testthat/helper_graphics.R:65
2: eval(bquote(expect_lt(compare_graph(.(short_name), tags), .(fuzz) + 0.1)))
3: expect_lt(compare_graph("hello_TeX", tags), 0 + 0.1)
4: expect_compare("<", act, exp)
5: expect(op(diff, 0), sprintf("%s is %s %s. Difference: %.3g", act$lab, msg, exp$lab, 
       diff))
6: as.expectation.logical(ok, failure_message, info = info, srcref = srcref)

Trimmed session info:

package     * version date       lib source  
devtools      2.0.1   2018-10-26 [1] CRAN (R 3.5.1)
rlang         0.3.0.1 2018-10-25 [1] CRAN (R 3.5.1)
testthat    * 2.0.1   2018-10-13 [1] CRAN (R 3.5.1)
tikzDevice  * 0.12.2  2018-11-13 [?] Github (daqana/tikzDevice@d93d010)
bellackn commented 5 years ago

Hello @karldw, thanks for reporting. We are aware of this issue and currently working on updating the tests. Unfortunately, we have no ETA for this. Adding a colorspace argument to compare_cmd seems to fix this issue:

https://github.com/daqana/tikzDevice/blob/d93d010c6d4d4689fa767b5b9c2c31cff41865e5/tests/testthat/helper_graphics.R#L134

If I put it like this, it works:

shQuote(compare_cmd), "-colorspace Gray -density 300", "-metric AE",

Probably the tests still won't run without errors after that (too large differences between compare file and test output) which seems to be related to the used ggplot2 versions. If you're interested in this, a PR is very welcome. :)

karldw commented 5 years ago

Good to know, and thanks for the quick response! I also don't have time to fix this in the near-term, but I'll keep it in mind.