asserthelper.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: tests/asserthelper.cpp
  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. #include "testprec.h"
  9. #ifdef __BORLANDC__
  10. #pragma hdrstop
  11. #endif
  12. #include "asserthelper.h"
  13. namespace
  14. {
  15. std::ostream& operator<<(std::ostream& os, const ColourChannel& cc)
  16. {
  17. os.width(2);
  18. os.fill('0');
  19. os << static_cast<int>(cc.m_value);
  20. return os;
  21. }
  22. } // anonymous namespace
  23. std::ostream& operator<<(std::ostream& os, const wxColour& c)
  24. {
  25. os << std::hex << std::noshowbase
  26. << "("
  27. << ColourChannel(c.Red()) << ", "
  28. << ColourChannel(c.Green()) << ", "
  29. << ColourChannel(c.Blue());
  30. if ( const unsigned char a = c.Alpha() )
  31. {
  32. os << ", " << ColourChannel(a);
  33. }
  34. os << ")";
  35. return os;
  36. }
  37. std::ostream& operator<<(std::ostream& os, const wxSize& s)
  38. {
  39. os << s.x << "x" << s.y;
  40. return os;
  41. }
  42. std::ostream& operator<<(std::ostream& os, const wxFont& f)
  43. {
  44. os << f.GetNativeFontInfoUserDesc();
  45. return os;
  46. }
  47. std::ostream& operator<<(std::ostream& os, const wxPoint& p)
  48. {
  49. os << "(" << p.x << ", " << p.y << ")";
  50. return os;
  51. }