aboutsummaryrefslogtreecommitdiff
path: root/src/unittest/test.cpp
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2022-09-26 06:49:08 -0400
committerGitHub <noreply@github.com>2022-09-26 06:49:08 -0400
commitf916398a541dbd09cbf14409f358556bc42f5535 (patch)
treecfec816907ef3226ae62c90611ea89e474c123b0 /src/unittest/test.cpp
parent8dec3a5ecbc6f74e2ca5d59f7bd905b8b136a591 (diff)
downloadminetest-f916398a541dbd09cbf14409f358556bc42f5535.tar.xz
Add lighting test and benchmark (#12802)
Diffstat (limited to 'src/unittest/test.cpp')
-rw-r--r--src/unittest/test.cpp56
1 files changed, 6 insertions, 50 deletions
diff --git a/src/unittest/test.cpp b/src/unittest/test.cpp
index af30c209d..149ab82b5 100644
--- a/src/unittest/test.cpp
+++ b/src/unittest/test.cpp
@@ -22,10 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/sound.h"
#include "nodedef.h"
#include "itemdef.h"
-#include "gamedef.h"
+#include "dummygamedef.h"
#include "modchannels.h"
-#include "content/mods.h"
-#include "database/database-dummy.h"
#include "util/numeric.h"
#include "porting.h"
@@ -42,36 +40,13 @@ content_t t_CONTENT_BRICK;
//// TestGameDef
////
-class TestGameDef : public IGameDef {
+class TestGameDef : public DummyGameDef {
public:
TestGameDef();
- ~TestGameDef();
-
- IItemDefManager *getItemDefManager() { return m_itemdef; }
- const NodeDefManager *getNodeDefManager() { return m_nodedef; }
- ICraftDefManager *getCraftDefManager() { return m_craftdef; }
- ITextureSource *getTextureSource() { return m_texturesrc; }
- IShaderSource *getShaderSource() { return m_shadersrc; }
- ISoundManager *getSoundManager() { return m_soundmgr; }
- scene::ISceneManager *getSceneManager() { return m_scenemgr; }
- IRollbackManager *getRollbackManager() { return m_rollbackmgr; }
- EmergeManager *getEmergeManager() { return m_emergemgr; }
- ModMetadataDatabase *getModStorageDatabase() { return m_mod_storage_database; }
-
- scene::IAnimatedMesh *getMesh(const std::string &filename) { return NULL; }
- bool checkLocalPrivilege(const std::string &priv) { return false; }
- u16 allocateUnknownNodeId(const std::string &name) { return 0; }
+ ~TestGameDef() = default;
void defineSomeNodes();
- virtual const std::vector<ModSpec> &getMods() const
- {
- static std::vector<ModSpec> testmodspec;
- return testmodspec;
- }
- virtual const ModSpec* getModSpec(const std::string &modname) const { return NULL; }
- virtual bool registerModStorage(ModMetadata *meta) { return true; }
- virtual void unregisterModStorage(const std::string &name) {}
bool joinModChannel(const std::string &channel);
bool leaveModChannel(const std::string &channel);
bool sendModChannelMessage(const std::string &channel, const std::string &message);
@@ -81,39 +56,18 @@ public:
}
private:
- IItemDefManager *m_itemdef = nullptr;
- const NodeDefManager *m_nodedef = nullptr;
- ICraftDefManager *m_craftdef = nullptr;
- ITextureSource *m_texturesrc = nullptr;
- IShaderSource *m_shadersrc = nullptr;
- ISoundManager *m_soundmgr = nullptr;
- scene::ISceneManager *m_scenemgr = nullptr;
- IRollbackManager *m_rollbackmgr = nullptr;
- EmergeManager *m_emergemgr = nullptr;
- ModMetadataDatabase *m_mod_storage_database = nullptr;
std::unique_ptr<ModChannelMgr> m_modchannel_mgr;
};
TestGameDef::TestGameDef() :
- m_mod_storage_database(new Database_Dummy()),
+ DummyGameDef(),
m_modchannel_mgr(new ModChannelMgr())
{
- m_itemdef = createItemDefManager();
- m_nodedef = createNodeDefManager();
-
defineSomeNodes();
}
-TestGameDef::~TestGameDef()
-{
- delete m_itemdef;
- delete m_nodedef;
- delete m_mod_storage_database;
-}
-
-
void TestGameDef::defineSomeNodes()
{
IWritableItemDefManager *idef = (IWritableItemDefManager *)m_itemdef;
@@ -185,6 +139,8 @@ void TestGameDef::defineSomeNodes()
f = ContentFeatures();
f.name = itemdef.name;
f.alpha = ALPHAMODE_BLEND;
+ f.light_propagates = true;
+ f.param_type = CPT_LIGHT;
f.liquid_type = LIQUID_SOURCE;
f.liquid_viscosity = 4;
f.is_ground_content = true;