Skip to content

Commit

Permalink
Combine tests of prep_fiji_* functions into a single file (for simpli…
Browse files Browse the repository at this point in the history
…city, consistency with the 'R/' directory, and to reduce redundant test code
  • Loading branch information
Nick-Eagles committed Oct 14, 2024
1 parent aa7e809 commit fdb052e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_that(
"prep_fiji_coords",
"prep_fiji",
{
########################################################################
# Prepare sample_info
Expand Down Expand Up @@ -38,7 +38,7 @@ test_that(
}

########################################################################
# Tests
# Test "prep_fiji_coords()"
########################################################################

spe_input_dir <- tempdir()
Expand All @@ -60,5 +60,26 @@ test_that(
"pxl_row_in_fullres", "pxl_col_in_fullres"
)
)

########################################################################
# Test "prep_fiji_image()"
########################################################################

out_paths_actual <- prep_fiji_image(
sample_info,
out_dir = spe_input_dir, lowres_max_size = 900
)

# The expected output files should be produced
out_paths_expected <- c(
file.path(spe_input_dir, "Br2719", "tissue_lowres_image.png"),
file.path(spe_input_dir, "Br2719", "scalefactors_json.json")
)
expect_equal(all(file.exists(out_paths_expected)), TRUE)
expect_equal(setequal(out_paths_actual, out_paths_expected), TRUE)

# The image should have the correct maximal dimension size
this_image <- imager::load.image(out_paths_expected[1])
expect_equal(max(dim(this_image)), 900)
}
)
62 changes: 0 additions & 62 deletions tests/testthat/test-prep_fiji_image.R

This file was deleted.

0 comments on commit fdb052e

Please sign in to comment.