test_that("ocr works", { file <- system.file("examples", "test2.png", package = "cpp11tesseract") numbers <- tesseract() expect_equal(tolower(ocr(file)), "this is a test.\n-$.0123456789\n") }) test_that("ocr works with whitelisted characters", { file <- system.file("examples", "test2.png", package = "cpp11tesseract") numbers <- tesseract(options = list(tessedit_char_whitelist = "-$.0123456789")) expect_equal(ocr(file, engine = numbers), ".\n-$.0123456789\n") expect_type(engine_info_internal(numbers)$datapath, "character") }) test_that("ocr works with raw image", { file <- system.file("examples", "test2.png", package = "cpp11tesseract") raw <- readBin(file, "raw", file.info(file)$size) expect_equal(tolower(ocr(raw)), "this is a test.\n-$.0123456789\n") }) test_that("ocr fails with bad parameters", { file <- system.file("examples", "test2.png", package = "cpp11tesseract") expect_error(ocr(file, engine = "enochian")) expect_error(ocr(NULL)) })