\r
using namespace irr;\r
\r
+static IrrlichtDevice *device = nullptr;\r
+static int test_fail = 0;\r
+\r
static video::E_DRIVER_TYPE chooseDriver(const char *arg_)\r
{\r
if (core::stringc(arg_) == "null")\r
return video::EDT_OPENGL;\r
}\r
\r
+static inline void check(bool ok, const char *msg)\r
+{\r
+ if (!ok)\r
+ {\r
+ test_fail++;\r
+ device->getLogger()->log((core::stringc("FAILED TEST: ") + msg).c_str(), ELL_ERROR);\r
+ }\r
+}\r
+\r
int main(int argc, char *argv[])\r
{\r
SIrrlichtCreationParameters p;\r
p.Vsync = true;\r
p.LoggingLevel = ELL_DEBUG;\r
\r
- IrrlichtDevice *device = createDeviceEx(p);\r
+ device = createDeviceEx(p);\r
if (!device)\r
return 1;\r
\r
+ {\r
+ u32 total = 0;\r
+ device->getOSOperator()->getSystemMemory(&total, nullptr);\r
+ core::stringc message = core::stringc("Total RAM in MiB: ") + core::stringc(total >> 10);\r
+ device->getLogger()->log(message.c_str(), ELL_INFORMATION);\r
+ check(total > 130 * 1024, "RAM amount");\r
+ }\r
+\r
device->setWindowCaption(L"Hello World!");\r
device->setResizable(true);\r
\r
const io::path mediaPath = getExampleMediaPath();\r
\r
scene::IAnimatedMesh* mesh = smgr->getMesh(mediaPath + "coolguy_opt.x");\r
- if (!mesh)\r
- return 1;\r
- scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);\r
- if (node)\r
+ check(mesh, "mesh loading");\r
+ if (mesh)\r
{\r
- node->setMaterialFlag(video::EMF_LIGHTING, false);\r
- node->setFrameLoop(0, 29);\r
- node->setAnimationSpeed(30);\r
- node->setMaterialTexture(0, driver->getTexture(mediaPath + "cooltexture.png"));\r
+ video::ITexture* tex = driver->getTexture(mediaPath + "cooltexture.png");\r
+ check(tex, "texture loading");\r
+ scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);\r
+ if (node)\r
+ {\r
+ node->setMaterialFlag(video::EMF_LIGHTING, false);\r
+ node->setFrameLoop(0, 29);\r
+ node->setAnimationSpeed(30);\r
+ node->setMaterialTexture(0, tex);\r
+ }\r
}\r
\r
smgr->addCameraSceneNode(0, core::vector3df(0,4,5), core::vector3df(0,2,0));\r
driver->endScene();\r
}\r
\r
- if (core::stringw(L"a") != editbox->getText()) {\r
- device->getLogger()->log("EditBox text mismatch", ELL_INFORMATION);\r
- return 1;\r
- }\r
+ check(core::stringw(L"a") == editbox->getText(), "EditBox text");\r
\r
device->getLogger()->log("Done.", ELL_INFORMATION);\r
device->drop();\r
- return 0;\r
+ return test_fail > 0 ? 1 : 0;\r
}\r