AutomatedTest: improve and run under macOS CI too
This commit is contained in:
		
							
								
								
									
										6
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							@@ -112,5 +112,9 @@ jobs:
 | 
			
		||||
 | 
			
		||||
      - name: Build
 | 
			
		||||
        run: |
 | 
			
		||||
          cmake . -DCMAKE_FIND_FRAMEWORK=LAST
 | 
			
		||||
          cmake . -DCMAKE_FIND_FRAMEWORK=LAST -DBUILD_EXAMPLES=1
 | 
			
		||||
          make -j3
 | 
			
		||||
 | 
			
		||||
      - name: Test (headless)
 | 
			
		||||
        run: |
 | 
			
		||||
          ./bin/OSX/AutomatedTest null
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,9 @@
 | 
			
		||||
 | 
			
		||||
using namespace irr;
 | 
			
		||||
 | 
			
		||||
static IrrlichtDevice *device = nullptr;
 | 
			
		||||
static int test_fail = 0;
 | 
			
		||||
 | 
			
		||||
static video::E_DRIVER_TYPE chooseDriver(const char *arg_)
 | 
			
		||||
{
 | 
			
		||||
	if (core::stringc(arg_) == "null")
 | 
			
		||||
@@ -15,6 +18,15 @@ static video::E_DRIVER_TYPE chooseDriver(const char *arg_)
 | 
			
		||||
	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[])
 | 
			
		||||
{
 | 
			
		||||
	SIrrlichtCreationParameters p;
 | 
			
		||||
@@ -23,10 +35,18 @@ int main(int argc, char *argv[])
 | 
			
		||||
	p.Vsync = true;
 | 
			
		||||
	p.LoggingLevel = ELL_DEBUG;
 | 
			
		||||
 | 
			
		||||
	IrrlichtDevice *device = createDeviceEx(p);
 | 
			
		||||
	device = createDeviceEx(p);
 | 
			
		||||
	if (!device)
 | 
			
		||||
		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->setResizable(true);
 | 
			
		||||
 | 
			
		||||
@@ -46,15 +66,19 @@ int main(int argc, char *argv[])
 | 
			
		||||
	const io::path mediaPath = getExampleMediaPath();
 | 
			
		||||
 | 
			
		||||
	scene::IAnimatedMesh* mesh = smgr->getMesh(mediaPath + "coolguy_opt.x");
 | 
			
		||||
	if (!mesh)
 | 
			
		||||
		return 1;
 | 
			
		||||
	scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
 | 
			
		||||
	if (node)
 | 
			
		||||
	check(mesh, "mesh loading");
 | 
			
		||||
	if (mesh)
 | 
			
		||||
	{
 | 
			
		||||
		node->setMaterialFlag(video::EMF_LIGHTING, false);
 | 
			
		||||
		node->setFrameLoop(0, 29);
 | 
			
		||||
		node->setAnimationSpeed(30);
 | 
			
		||||
		node->setMaterialTexture(0, driver->getTexture(mediaPath + "cooltexture.png"));
 | 
			
		||||
		video::ITexture* tex = driver->getTexture(mediaPath + "cooltexture.png");
 | 
			
		||||
		check(tex, "texture loading");
 | 
			
		||||
		scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
 | 
			
		||||
		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));
 | 
			
		||||
@@ -102,12 +126,9 @@ int main(int argc, char *argv[])
 | 
			
		||||
		driver->endScene();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (core::stringw(L"a") != editbox->getText()) {
 | 
			
		||||
		device->getLogger()->log("EditBox text mismatch", ELL_INFORMATION);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	check(core::stringw(L"a") == editbox->getText(), "EditBox text");
 | 
			
		||||
 | 
			
		||||
	device->getLogger()->log("Done.", ELL_INFORMATION);
 | 
			
		||||
	device->drop();
 | 
			
		||||
	return 0;
 | 
			
		||||
	return test_fail > 0 ? 1 : 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user