drawRectOutline.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "testUtils.h"
  2. using namespace irr;
  3. namespace
  4. {
  5. bool testWithDriver(video::E_DRIVER_TYPE driverType)
  6. {
  7. IrrlichtDevice *device =
  8. createDevice(driverType, core::dimension2du(160, 120));
  9. if (!device)
  10. return true;
  11. video::IVideoDriver* driver = device->getVideoDriver();
  12. stabilizeScreenBackground(driver);
  13. logTestString("Testing driver %ls\n", driver->getName());
  14. driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,100,101,140));
  15. core::recti r;
  16. r.UpperLeftCorner = core::position2di(1,1);
  17. r.LowerRightCorner = core::position2di(100,100);
  18. driver->draw2DRectangleOutline( r );
  19. r += core::position2di( 10 , 10 );
  20. driver->draw2DRectangleOutline( r , video::SColor(128, 255, 128, 128) );
  21. driver->getMaterial2D().Thickness=12.f;
  22. driver->enableMaterial2D();
  23. r += core::position2di( 10 , 10 );
  24. driver->draw2DRectangleOutline( r , video::SColor(128, 255, 128, 128) );
  25. driver->endScene();
  26. bool result = takeScreenshotAndCompareAgainstReference(driver, "-drawRectOutline.png", 98.5f );
  27. device->closeDevice();
  28. device->run();
  29. device->drop();
  30. return result ;
  31. }
  32. }
  33. bool drawRectOutline(void)
  34. {
  35. // TODO: Only OpenGL supports thick lines
  36. bool result = true;
  37. TestWithAllDrivers(testWithDriver);
  38. return result;
  39. }