Description Usage Arguments Author(s) See Also Examples
Tests an image file with ImageMagick ('RTestTest_image')
1 | test_returnValue_image(result, reference, xmlTestSpec, add.desc = NULL)
|
result |
( |
reference |
( |
xmlTestSpec |
( |
add.desc |
( |
Sebastian Wolf sebastian.wolf.sw1@roche.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # Cleaning up
tryCatch(unloadNamespace("RTest"))
tryCatch(unloadNamespace("testthat"))
library(RTest)
# create some definition of tests
data <- '<test_image desc="Compare a value" diff-type="relative"
compare-type="equal" tolerance="0"/>'
xmlTestSpec <- XML::xmlRoot(XML::xmlParse(data,asText=TRUE))
location <- find.package("RTest")
# Create a test with equal images
result <- paste0(location,"/images/Roche_Logo.png")
reference <- paste0(location,"/images/Roche_Logo.png")
test_returnValue_image(result,reference,xmlTestSpec)
# Create a test with images that are not equal
reference <- paste0(location,"/images/Roche_Logo_defect.png")
tryCatch(
test_returnValue_image(result,reference,xmlTestSpec),
error=function(e){
if(!grepl("not equal to",e)){
stop("image omparison defect, please check code")
}
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.