Move operator<<(std::ostream&, wxRect) overload to a header

This will allow reusing it in other tests too.

Also make the output slightly more readable by formatting the rectangle
as "{x,y w*h}" instead of "{x,y,w,h}".

No real changes.
This commit is contained in:
Vadim Zeitlin 2018-11-04 18:05:25 +01:00
parent 9d2ee59138
commit 12f8ab20f9
3 changed files with 10 additions and 12 deletions

View File

@ -67,3 +67,11 @@ std::ostream& operator<<(std::ostream& os, const wxPoint& p)
return os;
}
std::ostream& operator<<(std::ostream& os, const wxRect& r)
{
os << "{"
<< r.x << ", " << r.y << " " << r.width << "*" << r.height
<< "}";
return os;
}

View File

@ -35,5 +35,6 @@ std::ostream& operator<<(std::ostream& os, const wxColour& c);
std::ostream& operator<<(std::ostream& os, const wxSize& s);
std::ostream& operator<<(std::ostream& os, const wxFont& f);
std::ostream& operator<<(std::ostream& os, const wxPoint& p);
std::ostream& operator<<(std::ostream& os, const wxRect& r);
#endif

View File

@ -22,18 +22,7 @@
#include "wx/iosfwrap.h"
// ----------------------------------------------------------------------------
// helper functions
// ----------------------------------------------------------------------------
// this operator is needed to use CPPUNIT_ASSERT_EQUAL with wxRects
std::ostream& operator<<(std::ostream& os, const wxRect& r)
{
os << "{"
<< r.x << ", " << r.y << ", " << r.width << ", " << r.height
<< "}";
return os;
}
#include "asserthelper.h"
// ----------------------------------------------------------------------------
// test class