File: ILUTest.cpp

package info (click to toggle)
devil 1.6.8-rc2-3%2Blenny1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 10,004 kB
  • ctags: 4,659
  • sloc: ansic: 37,357; sh: 13,641; cpp: 7,193; pascal: 792; makefile: 348; python: 47
file content (64 lines) | stat: -rw-r--r-- 1,237 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// MoneyTest.cpp

#include "ILUTest.h"
#include <IL/il.h>
#include <IL/ilu.h>

// Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION( ILUTest );


void ILUTest::setUp()
{
  ilInit();
  iluInit();
}


void ILUTest::tearDown()
{
  const ILenum lResult = ilGetError();

  while (ilGetError() != IL_NO_ERROR) {;}

  ilResetMemory();
  CPPUNIT_ASSERT(ilGetError() == IL_NO_ERROR);

  CPPUNIT_ASSERT_MESSAGE("Received Error from ilGetError", lResult == IL_NO_ERROR);
}


void ILUTest::LoadStandardImage()
{
  ilLoadImage(".\\Data\\Logo.png");
}

void ILUTest::TestiluSaturate4f()
{
  ILuint MainImage = 0;

  FILE * lBuffer = fopen(".\\results\\result.bmp", "wb");
  ilGenImages(1, &MainImage);
  ilBindImage(MainImage);
  LoadStandardImage();
  ilConvertImage(IL_RGB,IL_BYTE);
  iluSaturate4f(-1.0, 0.0, 0.0, -1.0);
  iluMirror();
  iluBlurAvg(3);
  ilSaveF(IL_BMP,lBuffer);
  fclose(lBuffer);
}

void ILUTest::TestiluReplaceColour()
{
  ILuint MainImage = 0;

  FILE * lBuffer = fopen(".\\results\\result.bmp", "wb");
  ilGenImages(1, &MainImage);
  ilBindImage(MainImage);
  LoadStandardImage();
  ilConvertImage(IL_RGB,IL_BYTE);
  iluReplaceColour(1.0, 0.0, 0.0, 0.0);
  ilSaveF(IL_BMP,lBuffer);
  fclose(lBuffer);
}