diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 3473353..fa785a5 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -66,22 +66,22 @@ if (base::isFALSE(dep_check[["do_LigandReceptorPlot"]])){ liana_output <- readRDS(system.file("extdata/liana_output_example.rds", package = "SCpubr")) } -if (base::isFALSE(dep_check[["do_DimPlot"]]) & - base::isFALSE(dep_check[["do_CorrelationPlot"]]) & - base::isFALSE(dep_check[["do_ChordDiagramPlot"]]) & - isTRUE(requireNamespace(pkg, quietly = TRUE)) & - base::isFALSE(dep_check[["save_Plot"]])){ - p <- SCpubr::do_DimPlot(sample) - data <- data.frame("A" = stats::runif(n = 10), - "B" = stats::runif(n = 10), - "C" = stats::runif(n = 10), - "D" = stats::runif(n = 10)) - data <- as.matrix(data) - p.pheatmap <- pheatmap::pheatmap(data, cluster_rows = FALSE, cluster_cols = FALSE) - p.heatmap <- ComplexHeatmap::Heatmap(data, cluster_rows = FALSE, cluster_columns = FALSE) - p.chord <- SCpubr::do_ChordDiagramPlot(sample = sample, from = "seurat_clusters", to = "orig.ident") - figure_path <- getwd() -} +#if (base::isFALSE(dep_check[["do_DimPlot"]]) & +# base::isFALSE(dep_check[["do_CorrelationPlot"]]) & +# base::isFALSE(dep_check[["do_ChordDiagramPlot"]]) & +# isTRUE(requireNamespace(pkg, quietly = TRUE)) & +# base::isFALSE(dep_check[["save_Plot"]])){ + #p <- SCpubr::do_DimPlot(sample) + #data <- data.frame("A" = stats::runif(n = 10), + # "B" = stats::runif(n = 10), + # "C" = stats::runif(n = 10), + # "D" = stats::runif(n = 10)) + #data <- as.matrix(data) + #p.pheatmap <- pheatmap::pheatmap(data, cluster_rows = FALSE, cluster_cols = FALSE) + #p.heatmap <- ComplexHeatmap::Heatmap(data, cluster_rows = FALSE, cluster_columns = FALSE) + #p.chord <- SCpubr::do_ChordDiagramPlot(sample = sample, from = "seurat_clusters", to = "orig.ident") + #figure_path <- getwd() +#} #monocle_sample <- sample diff --git a/tests/testthat/test-save_Plot.R b/tests/testthat/test-save_Plot.R deleted file mode 100644 index 9e33f2d..0000000 --- a/tests/testthat/test-save_Plot.R +++ /dev/null @@ -1,222 +0,0 @@ -if(base::isFALSE(dep_check[["save_Plot"]])){ - testthat::test_that("save_Plot: PASS - no file", { - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - output_format = "svg")) - - }) - - testthat::test_that("save_Plot: PASS - no file path", { - - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - file_name = "test", - output_format = "svg")) - - }) - - testthat::test_that("save_Plot: PASS - null file path", { - - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - file_name = "test", - output_format = "svg")) - - }) - - testthat::test_that("save_Plot: PASS - no file path", { - - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - figure_path = paste0(figure_path, "/deleteme"), - file_name = "test", - output_format = "svg")) - - }) - - testthat::test_that("save_Plot: FAIL - wrong output format", { - testthat::skip_on_ci() - testthat::expect_error(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - file_name = "test", - output_format = "wrong")) - - }) - - testthat::test_that("save_Plot: FAIL - all and publication at the same time.", { - - - testthat::expect_error(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - file_name = "test", - output_format = c("all", "publication"))) - }) - - testthat::test_that("save_Plot: PASS - all", { - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - file_name = "test", - output_format = "all")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.heatmap, - figure_path = figure_path, - file_name = "test", - output_format = "all")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.pheatmap, - figure_path = figure_path, - file_name = "test", - output_format = "all")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.chord, - figure_path = figure_path, - file_name = "test", - output_format = "all")) - - }) - - testthat::test_that("save_Plot: PASS - publication", { - - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - file_name = "test", - output_format = "publication")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.heatmap, - figure_path = figure_path, - file_name = "test", - output_format = "publication")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.pheatmap, - figure_path = figure_path, - file_name = "test", - output_format = "publication")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.chord, - figure_path = figure_path, - file_name = "test", - output_format = "publication")) - - - }) - - testthat::test_that("save_Plot: PASS - jpeg", { - - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - file_name = "test", - output_format = "jpeg")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.heatmap, - figure_path = figure_path, - file_name = "test", - output_format = "jpeg")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.pheatmap, - figure_path = figure_path, - file_name = "test", - output_format = "jpeg")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.chord, - figure_path = figure_path, - file_name = "test", - output_format = "jpeg")) - }) - - testthat::test_that("save_Plot: PASS - png", { - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - file_name = "test", - output_format = "png")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.heatmap, - figure_path = figure_path, - file_name = "test", - output_format = "png")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.pheatmap, - figure_path = figure_path, - file_name = "test", - output_format = "png")) - }) - - testthat::test_that("save_Plot: PASS - pdf", { - - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - file_name = "test", - output_format = "pdf")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.heatmap, - figure_path = figure_path, - file_name = "test", - output_format = "pdf")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.pheatmap, - figure_path = figure_path, - file_name = "test", - output_format = "pdf")) - }) - - testthat::test_that("save_Plot: PASS - tiff", { - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - file_name = "test", - output_format = "tiff")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.heatmap, - figure_path = figure_path, - file_name = "test", - output_format = "tiff")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.pheatmap, - figure_path = figure_path, - file_name = "test", - output_format = "tiff")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.chord, - figure_path = figure_path, - file_name = "test", - output_format = "tiff")) - }) - - testthat::test_that("save_Plot: PASS - svg", { - testthat::skip_on_ci() - testthat::expect_silent(SCpubr::save_Plot(plot = p, - figure_path = figure_path, - file_name = "test", - output_format = "svg")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.heatmap, - figure_path = figure_path, - file_name = "test", - output_format = "svg")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.pheatmap, - figure_path = figure_path, - file_name = "test", - output_format = "svg")) - - testthat::expect_silent(SCpubr::save_Plot(plot = p.chord, - figure_path = figure_path, - file_name = "test", - output_format = "svg")) - }) - - - unlink(paste0(figure_path, "*.svg")) - unlink(paste0(figure_path, "test.jpeg")) - unlink(paste0(figure_path, "test.pdf")) - unlink(paste0(figure_path, "test.tiff")) - unlink(paste0(figure_path, "test.png")) - unlink(paste0(figure_path, "/deleteme"), recursive = TRUE) - -} -