axmol/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.h

114 lines
3.0 KiB
C
Raw Normal View History

2013-09-06 11:02:04 +08:00
/*
*
*/
#ifndef __PERFORMANCE_ALLOC_TEST_H__
#define __PERFORMANCE_ALLOC_TEST_H__
#include "BaseTest.h"
2013-09-06 11:02:04 +08:00
DEFINE_TEST_SUITE(PerformceAllocTests);
2013-09-06 11:02:04 +08:00
class PerformceAllocScene : public TestCase
2013-09-06 11:02:04 +08:00
{
public:
virtual bool init() override;
2013-09-06 11:02:04 +08:00
virtual void initWithQuantityOfNodes(unsigned int nNodes);
2015-07-15 12:04:48 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 11:02:04 +08:00
virtual void updateQuantityOfNodes() = 0;
const char* profilerName();
void updateProfilerName();
// for the profiler
virtual const char* testName() = 0;
void updateQuantityLabel();
int getQuantityOfNodes() { return quantityOfNodes; }
void dumpProfilerInfo(float dt);
// overrides
virtual void onExitTransitionDidStart() override;
virtual void onEnterTransitionDidFinish() override;
protected:
char _profilerName[256];
int lastRenderedCount;
static int quantityOfNodes;
2013-09-06 11:02:04 +08:00
int currentQuantityOfNodes;
};
class NodeCreateTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(NodeCreateTest);
virtual void updateQuantityOfNodes() override;
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
virtual void update(float dt) override;
virtual const char* testName() override;
2013-09-06 11:02:04 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 11:02:04 +08:00
};
class NodeDeallocTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(NodeDeallocTest);
virtual void updateQuantityOfNodes() override;
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
virtual void update(float dt) override;
virtual const char* testName() override;
2013-09-06 11:02:04 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 11:02:04 +08:00
};
2013-09-06 12:35:15 +08:00
class SpriteCreateEmptyTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SpriteCreateEmptyTest);
virtual void updateQuantityOfNodes() override;
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
virtual void update(float dt) override;
virtual const char* testName() override;
2013-09-06 12:35:15 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 12:35:15 +08:00
};
2013-09-06 11:02:04 +08:00
class SpriteCreateTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SpriteCreateTest);
virtual void updateQuantityOfNodes() override;
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
virtual void update(float dt) override;
virtual const char* testName() override;
2013-09-06 11:02:04 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 11:02:04 +08:00
};
class SpriteDeallocTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SpriteDeallocTest);
virtual void updateQuantityOfNodes() override;
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
virtual void update(float dt) override;
virtual const char* testName() override;
2013-09-06 11:02:04 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 11:02:04 +08:00
};
#endif // __PERFORMANCE_ALLOC_TEST_H__