File: UnitTest.h

package info (click to toggle)
bullet 3.24%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 15,164 kB
  • sloc: cpp: 246,331; lisp: 12,017; ansic: 11,175; python: 630; makefile: 136; sh: 75
file content (59 lines) | stat: -rw-r--r-- 1,422 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
	GWEN
	Copyright (c) 2011 Facepunch Studios
	See license in Gwen.h
*/

#pragma once
#ifndef GWEN_UNITTEST_UNITTEST_H
#define GWEN_UNITTEST_UNITTEST_H

#include "Gwen/Gwen.h"
#include "Gwen/Align.h"
#include "Gwen/Utility.h"
#include "Gwen/Controls/WindowControl.h"
#include "Gwen/Controls/TabControl.h"
#include "Gwen/Controls/ListBox.h"

class UnitTest;

class GUnit : public Gwen::Controls::Base
{
public:
	GWEN_CONTROL_INLINE(GUnit, Gwen::Controls::Base)
	{
		m_pUnitTest = NULL;
	}

	void SetUnitTest(UnitTest* u) { m_pUnitTest = u; }

	void UnitPrint(const Gwen::UnicodeString& str);
	void UnitPrint(const Gwen::String& str);

	UnitTest* m_pUnitTest;
};

class UnitTest : public Gwen::Controls::WindowControl
{
public:
	GWEN_CONTROL(UnitTest, Gwen::Controls::WindowControl);

	void PrintText(const Gwen::UnicodeString& str);

	void Render(Gwen::Skin::Base* skin);

private:
	Gwen::Controls::TabControl* m_TabControl;
	Gwen::Controls::ListBox* m_TextOutput;
	unsigned int m_iFrames;
	float m_fLastSecond;
};

#define DEFINE_UNIT_TEST(name, displayname)                         \
	GUnit* RegisterUnitTest_##name(Gwen::Controls::TabControl* tab) \
	{                                                               \
		GUnit* u = new name(tab);                                   \
		tab->AddPage(displayname, u);                               \
		return u;                                                   \
	}
#endif