2009-01-27 05:23:36 -08:00
|
|
|
#include "testUtils.h"
|
2009-09-16 05:48:19 -07:00
|
|
|
|
2009-01-27 05:23:36 -08:00
|
|
|
using namespace irr;
|
|
|
|
|
2013-03-28 10:04:07 -07:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
2011-01-14 07:36:50 -08:00
|
|
|
bool testWithDriver(video::E_DRIVER_TYPE driverType)
|
2009-01-27 05:23:36 -08:00
|
|
|
{
|
|
|
|
IrrlichtDevice *device =
|
2011-01-14 07:36:50 -08:00
|
|
|
createDevice(driverType, core::dimension2du(160, 120));
|
|
|
|
if (!device)
|
|
|
|
return true;
|
|
|
|
|
2009-01-27 05:23:36 -08:00
|
|
|
video::IVideoDriver* driver = device->getVideoDriver();
|
|
|
|
|
2013-04-04 09:15:53 -07:00
|
|
|
stabilizeScreenBackground(driver);
|
|
|
|
|
2011-06-09 00:08:47 -07:00
|
|
|
logTestString("Testing driver %ls\n", driver->getName());
|
|
|
|
|
2015-11-12 14:32:01 -08:00
|
|
|
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140));
|
2009-01-27 05:23:36 -08:00
|
|
|
|
|
|
|
core::recti r;
|
|
|
|
r.UpperLeftCorner = core::position2di(1,1);
|
|
|
|
r.LowerRightCorner = core::position2di(100,100);
|
|
|
|
driver->draw2DRectangleOutline( r );
|
|
|
|
|
|
|
|
r += core::position2di( 10 , 10 );
|
|
|
|
driver->draw2DRectangleOutline( r , video::SColor(128, 255, 128, 128) );
|
|
|
|
|
2011-01-14 07:36:50 -08:00
|
|
|
driver->getMaterial2D().Thickness=12.f;
|
|
|
|
driver->enableMaterial2D();
|
|
|
|
r += core::position2di( 10 , 10 );
|
|
|
|
driver->draw2DRectangleOutline( r , video::SColor(128, 255, 128, 128) );
|
|
|
|
|
2009-01-27 05:23:36 -08:00
|
|
|
driver->endScene();
|
|
|
|
|
2011-01-14 07:36:50 -08:00
|
|
|
bool result = takeScreenshotAndCompareAgainstReference(driver, "-drawRectOutline.png", 98.5f );
|
2009-01-27 05:23:36 -08:00
|
|
|
|
2011-01-14 07:36:50 -08:00
|
|
|
device->closeDevice();
|
|
|
|
device->run();
|
2009-01-27 05:23:36 -08:00
|
|
|
device->drop();
|
|
|
|
|
|
|
|
return result ;
|
|
|
|
}
|
2013-03-28 10:04:07 -07:00
|
|
|
}
|
2011-01-14 07:36:50 -08:00
|
|
|
|
|
|
|
bool drawRectOutline(void)
|
|
|
|
{
|
|
|
|
// TODO: Only OpenGL supports thick lines
|
2011-06-09 00:08:47 -07:00
|
|
|
bool result = true;
|
|
|
|
TestWithAllDrivers(testWithDriver);
|
2011-01-14 07:36:50 -08:00
|
|
|
return result;
|
|
|
|
}
|