forked from Mirrorlandia_minetest/irrlicht
AutomatedTest: improve and run under macOS CI too
This commit is contained in:
parent
e469c54f76
commit
8b1d0db8e2
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -112,5 +112,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cmake . -DCMAKE_FIND_FRAMEWORK=LAST
|
cmake . -DCMAKE_FIND_FRAMEWORK=LAST -DBUILD_EXAMPLES=1
|
||||||
make -j3
|
make -j3
|
||||||
|
|
||||||
|
- name: Test (headless)
|
||||||
|
run: |
|
||||||
|
./bin/OSX/AutomatedTest null
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
using namespace irr;
|
using namespace irr;
|
||||||
|
|
||||||
|
static IrrlichtDevice *device = nullptr;
|
||||||
|
static int test_fail = 0;
|
||||||
|
|
||||||
static video::E_DRIVER_TYPE chooseDriver(const char *arg_)
|
static video::E_DRIVER_TYPE chooseDriver(const char *arg_)
|
||||||
{
|
{
|
||||||
if (core::stringc(arg_) == "null")
|
if (core::stringc(arg_) == "null")
|
||||||
@ -15,6 +18,15 @@ static video::E_DRIVER_TYPE chooseDriver(const char *arg_)
|
|||||||
return video::EDT_OPENGL;
|
return video::EDT_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void check(bool ok, const char *msg)
|
||||||
|
{
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
test_fail++;
|
||||||
|
device->getLogger()->log((core::stringc("FAILED TEST: ") + msg).c_str(), ELL_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SIrrlichtCreationParameters p;
|
SIrrlichtCreationParameters p;
|
||||||
@ -23,10 +35,18 @@ int main(int argc, char *argv[])
|
|||||||
p.Vsync = true;
|
p.Vsync = true;
|
||||||
p.LoggingLevel = ELL_DEBUG;
|
p.LoggingLevel = ELL_DEBUG;
|
||||||
|
|
||||||
IrrlichtDevice *device = createDeviceEx(p);
|
device = createDeviceEx(p);
|
||||||
if (!device)
|
if (!device)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
{
|
||||||
|
u32 total = 0;
|
||||||
|
device->getOSOperator()->getSystemMemory(&total, nullptr);
|
||||||
|
core::stringc message = core::stringc("Total RAM in MiB: ") + core::stringc(total >> 10);
|
||||||
|
device->getLogger()->log(message.c_str(), ELL_INFORMATION);
|
||||||
|
check(total > 130 * 1024, "RAM amount");
|
||||||
|
}
|
||||||
|
|
||||||
device->setWindowCaption(L"Hello World!");
|
device->setWindowCaption(L"Hello World!");
|
||||||
device->setResizable(true);
|
device->setResizable(true);
|
||||||
|
|
||||||
@ -46,15 +66,19 @@ int main(int argc, char *argv[])
|
|||||||
const io::path mediaPath = getExampleMediaPath();
|
const io::path mediaPath = getExampleMediaPath();
|
||||||
|
|
||||||
scene::IAnimatedMesh* mesh = smgr->getMesh(mediaPath + "coolguy_opt.x");
|
scene::IAnimatedMesh* mesh = smgr->getMesh(mediaPath + "coolguy_opt.x");
|
||||||
if (!mesh)
|
check(mesh, "mesh loading");
|
||||||
return 1;
|
if (mesh)
|
||||||
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
|
|
||||||
if (node)
|
|
||||||
{
|
{
|
||||||
node->setMaterialFlag(video::EMF_LIGHTING, false);
|
video::ITexture* tex = driver->getTexture(mediaPath + "cooltexture.png");
|
||||||
node->setFrameLoop(0, 29);
|
check(tex, "texture loading");
|
||||||
node->setAnimationSpeed(30);
|
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
|
||||||
node->setMaterialTexture(0, driver->getTexture(mediaPath + "cooltexture.png"));
|
if (node)
|
||||||
|
{
|
||||||
|
node->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||||
|
node->setFrameLoop(0, 29);
|
||||||
|
node->setAnimationSpeed(30);
|
||||||
|
node->setMaterialTexture(0, tex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
smgr->addCameraSceneNode(0, core::vector3df(0,4,5), core::vector3df(0,2,0));
|
smgr->addCameraSceneNode(0, core::vector3df(0,4,5), core::vector3df(0,2,0));
|
||||||
@ -102,12 +126,9 @@ int main(int argc, char *argv[])
|
|||||||
driver->endScene();
|
driver->endScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core::stringw(L"a") != editbox->getText()) {
|
check(core::stringw(L"a") == editbox->getText(), "EditBox text");
|
||||||
device->getLogger()->log("EditBox text mismatch", ELL_INFORMATION);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
device->getLogger()->log("Done.", ELL_INFORMATION);
|
device->getLogger()->log("Done.", ELL_INFORMATION);
|
||||||
device->drop();
|
device->drop();
|
||||||
return 0;
|
return test_fail > 0 ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user