2015-02-17 16:28:49 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
2021-01-05 14:39:07 +00:00
|
|
|
* Copyright (C) 2021 Artem Pavlenko
|
2015-02-17 16:28:49 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VISUAL_TEST_RUNNER_HPP
|
|
|
|
#define VISUAL_TEST_RUNNER_HPP
|
|
|
|
|
|
|
|
#include "config.hpp"
|
|
|
|
#include "report.hpp"
|
|
|
|
#include "renderer.hpp"
|
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
namespace visual_tests {
|
2015-02-17 16:28:49 +00:00
|
|
|
|
|
|
|
class runner
|
|
|
|
{
|
2015-05-19 17:10:55 +00:00
|
|
|
using path_type = boost::filesystem::path;
|
|
|
|
using files_iterator = std::vector<path_type>::const_iterator;
|
2015-02-17 16:28:49 +00:00
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
public:
|
2015-09-16 11:24:14 +00:00
|
|
|
using renderer_container = std::vector<renderer_type>;
|
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
runner(path_type const& styles_dir,
|
|
|
|
config const& cfg,
|
2015-07-07 12:35:28 +00:00
|
|
|
std::size_t iterations,
|
2015-07-23 14:40:00 +00:00
|
|
|
std::size_t fail_limit,
|
2015-09-16 11:24:14 +00:00
|
|
|
std::size_t jobs,
|
2022-01-26 22:25:53 +00:00
|
|
|
renderer_container const& renderers);
|
2015-02-17 16:28:49 +00:00
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
result_list test_all(report_type& report) const;
|
|
|
|
result_list test(std::vector<std::string> const& style_names, report_type& report) const;
|
2015-02-17 16:28:49 +00:00
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
private:
|
|
|
|
result_list test_parallel(std::vector<path_type> const& files, report_type& report, std::size_t jobs) const;
|
2015-07-23 14:40:00 +00:00
|
|
|
result_list test_range(files_iterator begin,
|
|
|
|
files_iterator end,
|
|
|
|
std::reference_wrapper<report_type> report,
|
|
|
|
std::reference_wrapper<std::atomic<std::size_t>> fail_limit) const;
|
2022-01-26 22:25:53 +00:00
|
|
|
result_list test_one(path_type const& style_path, report_type& report, std::atomic<std::size_t>& fail_limit) const;
|
|
|
|
void parse_params(mapnik::parameters const& params, config& cfg) const;
|
2015-02-17 16:28:49 +00:00
|
|
|
|
2015-05-19 17:10:55 +00:00
|
|
|
const path_type styles_dir_;
|
2015-09-16 13:12:44 +00:00
|
|
|
const config defaults_;
|
2015-02-17 16:28:49 +00:00
|
|
|
const std::size_t jobs_;
|
2015-07-07 12:35:28 +00:00
|
|
|
const std::size_t iterations_;
|
2015-07-23 14:40:00 +00:00
|
|
|
const std::size_t fail_limit_;
|
2015-09-16 11:24:14 +00:00
|
|
|
const renderer_container renderers_;
|
2015-02-17 16:28:49 +00:00
|
|
|
};
|
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
} // namespace visual_tests
|
2015-02-17 16:28:49 +00:00
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
#endif // VISUAL_TEST_RUNNER_HPP
|