~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to tests/createImage.cpp

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "testUtils.h"
 
2
 
 
3
using namespace irr;
 
4
 
 
5
static bool testImageCreation()
 
6
{
 
7
        // create device
 
8
 
 
9
        IrrlichtDevice *device = createDevice(video::EDT_SOFTWARE, core::dimension2d<u32>(160,120));
 
10
 
 
11
        if (device == 0)
 
12
                return true; // could not create selected driver.
 
13
 
 
14
        video::IVideoDriver* driver = device->getVideoDriver();
 
15
        video::ITexture* tex=driver->getTexture("../media/water.jpg");
 
16
        video::IImage* img1=driver->createImage(tex, core::vector2di(0,0), core::dimension2du(32,32));
 
17
        video::ITexture* tex1=driver->addTexture("new1", img1);
 
18
        video::IImage* img2=driver->createImage(tex, core::vector2di(0,0), tex->getSize());
 
19
        video::ITexture* tex2=driver->addTexture("new2", img2);
 
20
 
 
21
        driver->beginScene(true, true, video::SColor(255,255,0,255));//Backbuffer background is pink
 
22
 
 
23
        driver->draw2DImage(tex, core::position2d<s32>(0,0), core::recti(0,0,32,32));
 
24
        driver->draw2DImage(tex1, core::position2d<s32>(32,0));
 
25
        driver->draw2DImage(tex2, core::position2d<s32>(64,0), core::recti(0,0,32,32));
 
26
 
 
27
        driver->endScene();
 
28
 
 
29
        bool result = takeScreenshotAndCompareAgainstReference(driver, "-createImage.png");
 
30
 
 
31
        device->closeDevice();
 
32
        device->run();
 
33
        device->drop();
 
34
 
 
35
        return result;
 
36
}
 
37
 
 
38
bool createImage()
 
39
{
 
40
        bool result = testImageCreation();
 
41
        return result;
 
42
}