diff --git a/src/input/keyplot.cpp b/src/input/keyplot.cpp index 7422ba528..c52c12413 100644 --- a/src/input/keyplot.cpp +++ b/src/input/keyplot.cpp @@ -11,6 +11,8 @@ int main(void){ } std::unique_ptr n(nc.get_stdplane ()); struct ncplot_options popts{}; + popts.rangex = 60; + popts.detectrange = true; struct ncplot* plot = ncplot_create(*n, &popts); char32_t r; ncinput ni; diff --git a/tests/plot.cpp b/tests/plot.cpp index 2e5a68b1d..a985d3939 100644 --- a/tests/plot.cpp +++ b/tests/plot.cpp @@ -20,6 +20,28 @@ TEST_CASE("Plot") { REQUIRE(n_); REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0)); + // setting detectrange with non-zero domain limits is invalid + SUBCASE("DetectRangeBadY"){ + ncplot_options popts{}; + popts.detectrange = true; + popts.miny = -1; + ncplot* p = ncplot_create(n_, &popts); + CHECK(nullptr == p); + popts.miny = 0; + popts.maxy = 1; + ncplot* p = ncplot_create(n_, &popts); + CHECK(nullptr == p); + } + + // maxy < miny is invalid + SUBCASE("RejectMaxyLessMiny"){ + ncplot_options popts{}; + popts.miny = 2; + popts.maxy = 1; + ncplot* p = ncplot_create(n_, &popts); + CHECK(nullptr == p); + } + SUBCASE("SimplePlot"){ ncplot_options popts{}; ncplot* p = ncplot_create(n_, &popts);