Skip to content

Commit

Permalink
visual tests: report failed tests (mapnik#3765)
Browse files Browse the repository at this point in the history
  • Loading branch information
talaj authored and Algunenano committed Mar 25, 2019
1 parent 3ea535b commit f4188ea
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 17 deletions.
62 changes: 45 additions & 17 deletions test/visual/report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,7 @@ void console_report::report(result const & r)
s << '-' << r.tiles.width << 'x' << r.tiles.height;
}
s << '-' << std::fixed << std::setprecision(1) << r.scale_factor << "\" with " << r.renderer_name << "... ";

switch (r.state)
{
case STATE_OK:
s << "OK";
break;
case STATE_FAIL:
s << "FAILED (" << r.diff << " different pixels)";
break;
case STATE_OVERWRITE:
s << "OVERWRITTEN (" << r.diff << " different pixels)";
break;
case STATE_ERROR:
s << "ERROR (" << r.error_message << ")";
break;
}
report_state(r);

if (show_duration)
{
Expand Down Expand Up @@ -115,7 +100,50 @@ unsigned console_report::summary(result_list const & results)
s << "total: \t" << duration_cast<milliseconds>(total).count() << " milliseconds" << std::endl;
}

return fail + error + overwrite;
s << std::endl;
report_failures(results);
s << std::endl;

return fail + error;
}

void console_report::report_state(result const & r)
{
switch (r.state)
{
case STATE_OK:
s << "OK";
break;
case STATE_FAIL:
s << "FAILED (" << r.diff << " different pixels)";
break;
case STATE_OVERWRITE:
s << "OVERWRITTEN (" << r.diff << " different pixels)";
break;
case STATE_ERROR:
s << "ERROR (" << r.error_message << ")";
break;
}
}

void console_report::report_failures(result_list const & results)
{
for (auto const & r : results)
{
if (r.state == STATE_OK)
{
continue;
}

s << r.name << " ";
report_state(r);
s << std::endl;
if (!r.actual_image_path.empty())
{
s << " " << r.actual_image_path << " (actual)" << std::endl;
s << " " << r.reference_image_path << " (reference)" << std::endl;
}
}
}

void console_short_report::report(result const & r)
Expand Down
3 changes: 3 additions & 0 deletions test/visual/report.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class console_report
unsigned summary(result_list const & results);

protected:
void report_state(result const & r);
void report_failures(result_list const & results);

std::ostream & s;
bool show_duration;
};
Expand Down

0 comments on commit f4188ea

Please sign in to comment.