visual tests: add command line parameters for scale-factor settings

This commit is contained in:
Jiri Drbalek 2015-09-16 13:12:44 +00:00
parent fd19c754f3
commit ae8ac89ef8
4 changed files with 13 additions and 4 deletions

View file

@ -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

View file

@ -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<std::vector<double>>()->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<std::vector<double>>();
runner run(vm["styles-dir"].as<std::string>(),
defaults,
vm["iterations"].as<std::size_t>(),
vm["limit"].as<std::size_t>(),
vm["jobs"].as<std::size_t>(),

View file

@ -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_type> report,
std::reference_wrapper<std::atomic<std::size_t>> 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<std::size_t> & fail_count) const
{
config cfg(defaults_);
mapnik::Map map(cfg.sizes.front().width, cfg.sizes.front().height);
result_list results;

View file

@ -40,6 +40,7 @@ public:
using renderer_container = std::vector<renderer_type>;
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_type> report,
std::reference_wrapper<std::atomic<std::size_t>> fail_limit) const;
result_list test_one(path_type const & style_path,
config cfg, report_type & report,
report_type & report,
std::atomic<std::size_t> & fail_limit) const;
void parse_map_sizes(std::string const & str, std::vector<map_size> & sizes) const;
const map_sizes_grammar<std::string::const_iterator> 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_;