From ae8ac89ef84b734bdbe8c1d0760bf6226cef929a Mon Sep 17 00:00:00 2001 From: Jiri Drbalek Date: Wed, 16 Sep 2015 13:12:44 +0000 Subject: [PATCH] visual tests: add command line parameters for scale-factor settings --- CHANGELOG.md | 1 + test/visual/run.cpp | 5 +++++ test/visual/runner.cpp | 7 ++++--- test/visual/runner.hpp | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 889e4adc0..36b739b98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Released: YYYY XX, 2015 #### Summary - Visual tests: new command line arguments `--agg`, `--cairo`, `--svg`, `--grid` for selecting renderers (https://github.com/mapnik/mapnik/pull/3074) +- Visual tests: new command line argument `--scale-factor` or abbreviated `-s` for setting scale factor (https://github.com/mapnik/mapnik/pull/3074) ## 3.0.5 diff --git a/test/visual/run.cpp b/test/visual/run.cpp index e00ae0ae1..70284bc3e 100644 --- a/test/visual/run.cpp +++ b/test/visual/run.cpp @@ -108,6 +108,7 @@ int main(int argc, char** argv) [](log_levels_map::value_type const & level) { return level.second == mapnik::logger::get_severity(); } )->first), "log level (debug, warn, error, none)") #endif + ("scale-factor,s", po::value>()->default_value({ 1.0, 2.0 }, "1.0, 2.0"), "scale factor") (agg_renderer::name, "render with AGG renderer") #if defined(HAVE_CAIRO) (cairo_renderer::name, "render with Cairo renderer") @@ -156,7 +157,11 @@ int main(int argc, char** argv) output_dir /= boost::filesystem::unique_path(); } + config defaults; + defaults.scales = vm["scale-factor"].as>(); + runner run(vm["styles-dir"].as(), + defaults, vm["iterations"].as(), vm["limit"].as(), vm["jobs"].as(), diff --git a/test/visual/runner.cpp b/test/visual/runner.cpp index f8e8e4e1c..06ade7779 100644 --- a/test/visual/runner.cpp +++ b/test/visual/runner.cpp @@ -126,11 +126,13 @@ private: }; runner::runner(runner::path_type const & styles_dir, + config const & defaults, std::size_t iterations, std::size_t fail_limit, std::size_t jobs, runner::renderer_container const & renderers) : styles_dir_(styles_dir), + defaults_(defaults), jobs_(jobs), iterations_(iterations), fail_limit_(fail_limit), @@ -211,7 +213,6 @@ result_list runner::test_range(files_iterator begin, std::reference_wrapper report, std::reference_wrapper> fail_count) const { - config defaults; result_list results; for (runner::files_iterator i = begin; i != end; i++) @@ -221,7 +222,7 @@ result_list runner::test_range(files_iterator begin, { try { - result_list r = test_one(file, defaults, report, fail_count.get()); + result_list r = test_one(file, report, fail_count.get()); std::move(r.begin(), r.end(), std::back_inserter(results)); } catch (std::exception const& ex) @@ -246,10 +247,10 @@ result_list runner::test_range(files_iterator begin, } result_list runner::test_one(runner::path_type const& style_path, - config cfg, report_type & report, std::atomic & fail_count) const { + config cfg(defaults_); mapnik::Map map(cfg.sizes.front().width, cfg.sizes.front().height); result_list results; diff --git a/test/visual/runner.hpp b/test/visual/runner.hpp index 0461c03af..e38e39422 100644 --- a/test/visual/runner.hpp +++ b/test/visual/runner.hpp @@ -40,6 +40,7 @@ public: using renderer_container = std::vector; runner(path_type const & styles_dir, + config const & cfg, std::size_t iterations, std::size_t fail_limit, std::size_t jobs, @@ -55,12 +56,13 @@ private: std::reference_wrapper report, std::reference_wrapper> fail_limit) const; result_list test_one(path_type const & style_path, - config cfg, report_type & report, + report_type & report, std::atomic & fail_limit) const; void parse_map_sizes(std::string const & str, std::vector & sizes) const; const map_sizes_grammar map_sizes_parser_; const path_type styles_dir_; + const config defaults_; const std::size_t jobs_; const std::size_t iterations_; const std::size_t fail_limit_;