asserthelper.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: tests/asserthelper.h
  3. // Purpose: Helper functions for cppunit
  4. // Author: Steven Lamerton
  5. // Created: 2010-07-23
  6. // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
  7. ///////////////////////////////////////////////////////////////////////////////
  8. #ifndef _WX_TESTS_ASSERTHELPER_H_
  9. #define _WX_TESTS_ASSERTHELPER_H_
  10. #include <ostream>
  11. #include "wx/colour.h"
  12. #include "wx/gdicmn.h"
  13. #include "wx/font.h"
  14. namespace
  15. {
  16. // by default colour components values are output incorrectly because they
  17. // are unsigned chars, define a small helper struct which formats them in
  18. // a more useful way
  19. struct ColourChannel
  20. {
  21. ColourChannel(unsigned char value) : m_value(value) { }
  22. unsigned char m_value;
  23. };
  24. std::ostream& operator<<(std::ostream& os, const ColourChannel& cc);
  25. } // anonymous namespace
  26. // this operator is needed to use CPPUNIT_ASSERT_EQUAL with wxColour objects
  27. std::ostream& operator<<(std::ostream& os, const wxColour& c);
  28. // this operator is needed to use CPPUNIT_ASSERT_EQUAL with wxSize objects
  29. std::ostream& operator<<(std::ostream& os, const wxSize& s);
  30. // this operator is needed to use CPPUNIT_ASSERT_EQUAL with wxFont objects
  31. std::ostream& operator<<(std::ostream& os, const wxFont& f);
  32. // this operator is needed to use CPPUNIT_ASSERT_EQUAL with wxPoint objects
  33. std::ostream& operator<<(std::ostream& os, const wxPoint& p);
  34. #endif