Skip to content

Commit

Permalink
tests: init visual testing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgohel committed Nov 27, 2022
1 parent 54344ff commit a219e33
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ URL: https://ardata-fr.github.io/officeverse/, https://ardata-fr.github.io/mscha
BugReports: https://github.com/ardata-fr/mschart/issues
RoxygenNote: 7.2.2
Roxygen: list(markdown = TRUE)
Suggests: tinytest
Suggests: tinytest, doconv
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions inst/tinytest/test_areachart.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@ dLblPos <- xml_find_all(chart, "//c:ser/c:dLbls/c:dLblPos")
# test that no dLblPos is found in the series
expect_true(length(dLblPos) < 1)

if (require("doconv")) {
using(doconv)
chart_01 <- ms_areachart(data = browser_ts, x = "date", y = "freq", group = "browser")
chart_01 <- chart_ax_x(chart_01, num_fmt = "m/d/yy", rotation = -90)
pptx_file <- tempfile(fileext = ".pptx")
doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with(doc, value = chart_01, location = ph_location_fullsize())
print(doc, target = pptx_file)
expect_snapshot_doc(x = pptx_file,name = "areachart-data-labels", engine = "tinytest")

}
12 changes: 11 additions & 1 deletion inst/tinytest/test_linechart.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dat <- data.frame(
stringsAsFactors=F)


# example areachart -------
chart_01 <- ms_linechart(data = dat, x = "musician", y = "count", group = "color")

settings <- c(green = 1L, unclear = 0L, gray = 0L)
Expand All @@ -33,3 +32,14 @@ smooth_data <- smooth_data[order(names(smooth_data))]

expect_equivalent(settings, smooth_data)


if (require("doconv")) {
using(doconv)
pptx_file <- tempfile(fileext = ".pptx")
doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with(doc, value = chart_01, location = ph_location_type(type = "body"))
print(doc, target = pptx_file)

expect_snapshot_doc(x = pptx_file,name = "linechart-data-smooth", engine = "tinytest")
}
Binary file modified man/figures/fig_ms_scatterchart_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a219e33

Please sign in to comment.