visual tests: report failed tests (#3765)

This commit is contained in:
talaj 2017-09-13 11:13:51 +02:00 committed by Jiri Drbalek
parent f8c6ad1e29
commit cfd9668fdb
2 changed files with 47 additions and 16 deletions

View file

@ -39,22 +39,7 @@ void console_report::report(result const & r)
s << '-' << r.tiles.width << 'x' << r.tiles.height; s << '-' << r.tiles.width << 'x' << r.tiles.height;
} }
s << '-' << std::fixed << std::setprecision(1) << r.scale_factor << "\" with " << r.renderer_name << "... "; s << '-' << std::fixed << std::setprecision(1) << r.scale_factor << "\" with " << r.renderer_name << "... ";
report_state(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;
}
if (show_duration) if (show_duration)
{ {
@ -115,9 +100,52 @@ unsigned console_report::summary(result_list const & results)
s << "total: \t" << duration_cast<milliseconds>(total).count() << " milliseconds" << std::endl; s << "total: \t" << duration_cast<milliseconds>(total).count() << " milliseconds" << std::endl;
} }
s << std::endl;
report_failures(results);
s << std::endl;
return fail + error; 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) void console_short_report::report(result const & r)
{ {
switch (r.state) switch (r.state)

View file

@ -48,6 +48,9 @@ public:
unsigned summary(result_list const & results); unsigned summary(result_list const & results);
protected: protected:
void report_state(result const & r);
void report_failures(result_list const & results);
std::ostream & s; std::ostream & s;
bool show_duration; bool show_duration;
}; };