R Under development (unstable) (2024-07-23 r86915 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > .TestPlotFunction <- function(plot.fn, ...) + { + # Calls fn with args, redirecting graphics output to a temporary file that + # is unlinked after the test + temp.path <- tempfile() + png(temp.path) + print(temp.path) + tryCatch(do.call(plot.fn, args=list(...)), + finally={dev.off(); unlink(temp.path)}) + } > > TestSimplePlotFunctions <- function() + { + # Test those plot functions that take a community object as the first, and + # only mandatory, argument + exclude <- c('PlotNPSDistribution', 'PlotRankNPS', 'PlotTLPS', 'PlotNPS', + 'PlotWagonWheel', 'PlotLinearModels') + for(fn in setdiff(ls('package:cheddar', pattern='Plot*'), exclude)) + { + cat(fn, '\n') + .TestPlotFunction(fn, TL84) + } + } > > TestPlotWagonWheel <- function() + { + .TestPlotFunction(PlotWagonWheel, TL84, focus=30) + } > > proc.time() user system elapsed 0.10 0.03 0.14