UnitTest.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. GWEN
  3. Copyright (c) 2011 Facepunch Studios
  4. See license in Gwen.h
  5. */
  6. #pragma once
  7. #ifndef GWEN_UNITTEST_UNITTEST_H
  8. #define GWEN_UNITTEST_UNITTEST_H
  9. #include "Gwen/Gwen.h"
  10. #include "Gwen/Align.h"
  11. #include "Gwen/Utility.h"
  12. #include "Gwen/Controls/WindowControl.h"
  13. #include "Gwen/Controls/TabControl.h"
  14. #include "Gwen/Controls/ListBox.h"
  15. class UnitTest;
  16. class GUnit : public Gwen::Controls::Base
  17. {
  18. public:
  19. GWEN_CONTROL_INLINE( GUnit, Gwen::Controls::Base )
  20. {
  21. m_pUnitTest = NULL;
  22. }
  23. void SetUnitTest( UnitTest* u ){ m_pUnitTest = u; }
  24. void UnitPrint( const Gwen::UnicodeString& str );
  25. void UnitPrint( const Gwen::String& str );
  26. UnitTest* m_pUnitTest;
  27. };
  28. class UnitTest : public Gwen::Controls::WindowControl
  29. {
  30. public:
  31. GWEN_CONTROL( UnitTest, Gwen::Controls::WindowControl );
  32. void PrintText( const Gwen::UnicodeString& str );
  33. void Render( Gwen::Skin::Base* skin );
  34. private:
  35. Gwen::Controls::TabControl* m_TabControl;
  36. Gwen::Controls::ListBox* m_TextOutput;
  37. unsigned int m_iFrames;
  38. float m_fLastSecond;
  39. };
  40. #define DEFINE_UNIT_TEST( name, displayname ) GUnit* RegisterUnitTest_##name( Gwen::Controls::TabControl* tab ){ GUnit* u = new name( tab ); tab->AddPage( displayname, u ); return u; }
  41. #endif