From 12f8ab20f998cc70e1de6fb00b801401daf65848 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 Nov 2018 18:05:25 +0100 Subject: [PATCH] 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. --- tests/asserthelper.cpp | 8 ++++++++ tests/asserthelper.h | 1 + tests/geometry/rect.cpp | 13 +------------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/asserthelper.cpp b/tests/asserthelper.cpp index 8f9f36d452..7b25cec2d6 100644 --- a/tests/asserthelper.cpp +++ b/tests/asserthelper.cpp @@ -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; +} diff --git a/tests/asserthelper.h b/tests/asserthelper.h index ce1d1fba2a..57772453bb 100644 --- a/tests/asserthelper.h +++ b/tests/asserthelper.h @@ -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 diff --git a/tests/geometry/rect.cpp b/tests/geometry/rect.cpp index 07634a3ce6..94e67c9574 100644 --- a/tests/geometry/rect.cpp +++ b/tests/geometry/rect.cpp @@ -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