1
// Copyright (C) 2008-2011 Colin MacDonald
2
// No rights reserved: this software is in the public domain.
13
/** This tests verifies that textures opened from different places in the
14
filesystem don't create duplicated textures. */
15
bool loadFromFileFolder(void)
17
IrrlichtDevice *device =
18
createDevice( video::EDT_NULL, dimension2du(160, 120));
22
logTestString("Unable to create EDT_NULL device\n");
26
IVideoDriver * driver = device->getVideoDriver();
28
u32 numTexs = driver->getTextureCount();
30
ITexture * tex1 = driver->getTexture("../media/tools.png");
33
logTestString("Unable to open ../media/tools.png\n");
34
if (driver->getTextureCount()!=numTexs+1)
36
logTestString("No additional texture in the texture cache %s:%d\n", __FILE__, __LINE__);
40
IReadFile * readFile = device->getFileSystem()->createAndOpenFile("../media/tools.png");
43
logTestString("Unable to open ../media/tools.png\n");
44
if (driver->getTextureCount()!=numTexs+1)
46
logTestString("Additional texture in the texture cache %s:%d\n", __FILE__, __LINE__);
50
ITexture * tex2 = driver->getTexture(readFile);
53
logTestString("Unable to create texture from ../media/tools.png\n");
54
if (driver->getTextureCount()!=numTexs+1)
56
logTestString("Additional texture in the texture cache %s:%d\n", __FILE__, __LINE__);
62
// adding a folder archive
63
device->getFileSystem()->addFileArchive( "../media/" );
65
ITexture * tex3 = driver->getTexture("tools.png");
68
logTestString("Unable to open tools.png\n");
69
if (driver->getTextureCount()!=numTexs+1)
71
logTestString("Additional texture in the texture cache %s:%d\n", __FILE__, __LINE__);
75
ITexture * tex4 = driver->getTexture("tools.png");
78
logTestString("Unable to open tools.png\n");
79
if (driver->getTextureCount()!=numTexs+1)
81
logTestString("Additional texture in the texture cache %s:%d\n", __FILE__, __LINE__);
85
device->closeDevice();
88
return ((tex1 == tex2) && (tex1 == tex3) && (tex1 == tex4));
94
result &= loadFromFileFolder();