Skip to content

Commit 4acfb31

Browse files
committed
Correct usage of boost test value printing
Looking at the [documentation][1] it seems that the intended method of printing "custom" types is implementing the << operator. This commit replaces the apparently platform-specific usage of boost::test_tools::print_log_value with operator << implementation. [1]: http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/boost_test/test_output/testing_tool_output_disable.html
1 parent 6e57ec2 commit 4acfb31

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

testing/testhelpers.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ QString TestHelpers::pdfFilename(const std::string& basename) {
1414
std::ostream& operator << (std::ostream& where, const QSize& what) {
1515
return where << "QSize(" << what.width() << 'x' << what.height() << ')';
1616
}
17+
18+
std::ostream& operator << (std::ostream& where, const QColor& what) {
19+
return where << "QColor(" << what.name().toStdString() << ")";
20+
}

testing/testhelpers.hh

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,5 @@ namespace TestHelpers {
5656
/** Print a QSize to a standard output stream */
5757
std::ostream& operator << (std::ostream& where, const QSize& what);
5858

59-
/** Print QRgb values as #123456 html-style-strings within boost test
60-
* log messages */
61-
namespace boost{
62-
namespace test_tools{
63-
namespace tt_detail {
64-
template<>
65-
inline
66-
void
67-
print_log_value<QColor>::operator()(std::ostream& where, const QColor& what) {
68-
where << what.name().toStdString();
69-
}
70-
}
71-
}
72-
}
59+
/** Print a QColor to a standard output stream */
60+
std::ostream& operator << (std::ostream& where, const QColor& what);

0 commit comments

Comments
 (0)