tests/testthat/test-getFragmentAnnotationData.R

labbcat.url <- Sys.getenv('TEST_READ_LABBCAT_URL')
username <- Sys.getenv('TEST_READ_LABBCAT_USERNAME')
password <- Sys.getenv('TEST_READ_LABBCAT_PASSWORD')

test_that("getFragmentAnnotationData works", {
    skip_on_cran() # don't run tests that depend on external resource on CRAN
    if (!is.null(labbcatCredentials(labbcat.url, username, password))) skip("Server not available")

    ## get a word we know contains some mediapipe face images
    results <- getMatches(labbcat.url, "vivid")
    
    ## define subdirectory
    subdir <- "test-getFragmentAnnotationData"
    
    ## Get a list of data files
    image.files <- getFragmentAnnotationData(
        labbcat.url, results$Transcript,
        results$Target.word.start, results$Target.word.end,
        "mediapipe",
        path=subdir)

    # some images returned
    expect_true(length(image.files) > 0)
    # we don't know how many, but they should be png files
    expect_true(endsWith(image.files[[1]], ".png"))

    ## tidy up
    file.remove(image.files)
    file.remove(subdir)
})

Try the nzilbb.labbcat package in your browser

Any scripts or data that you put into this service are public.

nzilbb.labbcat documentation built on Nov. 10, 2026, 5:08 p.m.